From fb9a61723363d0a82b6aae41d9e4151866b3e864 Mon Sep 17 00:00:00 2001
From: Immanuel Onyeka <immanuel@onyeka.ca>
Date: Wed, 5 Jan 2022 21:05:50 -0500
Subject: [PATCH] Add functions to reconfigure applications

---
 configure       | 17 ++++++++++++++++-
 dwm-start       | 25 -------------------------
 prompt          | 22 +++++++++++++++-------
 setup-xbindkeys |  2 +-
 4 files changed, 32 insertions(+), 34 deletions(-)
 delete mode 100755 dwm-start

diff --git a/configure b/configure
index 6d82f9a..be15297 100755
--- a/configure
+++ b/configure
@@ -39,11 +39,23 @@ vim() {
 	# Should copy plugins too
 }
 
+neomutt() {
+	sudo cp -r $CONFIGS/neomutt $XDG_CONFIG_HOME/
+}
+
+mbsync() {
+	cp $CONFIGS/mbsyncrc ~/.mbsyncrc
+}
+
 bash() {
 	cp $CONFIGS/.bashrc ~/.bashrc
 	cp $CONFIGS/.profile ~/.profile
 }
 
+rtorrent() {
+	cp $CONFIGS/.rtorrentrc 
+}
+
 # Used to configure a new system or reset things for an existing one.
 all() {
 	ls
@@ -54,6 +66,9 @@ case $1 in
 	builds) builds;;
 	vim) vim;;
 	macros) macros;;
+	rtorrent) rtorrent;;
+	neomutt) neomutt;;
 	bash) bash;;
-	*) printf "Invalid argument";;
+	mbsync) mbsync;;
+	*) printf "Invalid argument\n";;
 esac
diff --git a/dwm-start b/dwm-start
deleted file mode 100755
index cbdca5d..0000000
--- a/dwm-start
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/bash
-setxkbmap -option ctrl:swapcaps -option tilde:swapescape
-source ~/.profile
-picom -b
-~/.fehbg
-xbindkeys -f $HOME/Source/configs/xbindkeysrc
-
-( mru update; mru updatedirs ) &
-
-# relaunch DWM if the binary changes, otherwise bail
-csum=$(sha1sum $(which dwm))
-new_csum=""
-while true
-do
-	if [ "$csum" != "$new_csum"  ]
-	then
-		csum=$new_csum
-		dwm-statusbar &
-		dwm
-	else
-		exit 0
-	fi
-	new_csum=$(sha1sum $(which dwm))
-	sleep 0.5
-done
diff --git a/prompt b/prompt
index b36934b..3ccc6fc 100755
--- a/prompt
+++ b/prompt
@@ -69,8 +69,8 @@ launch() {
 		Tasks) st -t "Tasks" -e sh -lc taskwarrior-tui;;
 		Page) pages pager "$(printf "1\n2\n3\n" | dmenu -p 'page')";;
 		Games) games;;
-		Movie) mpv $(find /mnt/media/movies -name '*.m*' -type f -not -path '*.x/*' |
-			dmenu -i -c -l 20 -p 'Play');;
+		Movie) mpv $(find /mnt/media/movies -regex '.*\.m\(kv\)\|\(p.\)$'\
+			-type f -not -path '*.x/*' | dmenu -i -c -l 20 -p 'Play');;
 		Multiplexer) st -t "Multiplexer" -e tmux attach-session -t 0 ||
 			st -t "Multiplexer" -e tmux new-session -s 0;;
 		'Go page') num=$(go_page); pages pager $num;;
@@ -191,7 +191,7 @@ download() {
 
 download_music() {
 	youtube-dl -x --add-metadata --no-progress --audio-format mp3 -o \
-		"$HOME/music/new/%(track)s - %(artist)s.%(ext)s" "$(xclip -selection clipboard -o)"
+		"/mnt/media/music/new/%(track)s - %(artist)s.%(ext)s" "$(xclip -selection clipboard -o)"
 
 	if [ ! $? ]; then
 		youtube-dl -x --add-metadata --no-progress --audio-format mp3 -o \
@@ -478,16 +478,24 @@ choose() {
 	$c "$f"
 }
 
-# It finds all the current files in a known directory without needing to update the mru list of files
-# If the directory is chosen instead of the file within it, it opens the directory with nnn
+# It finds all the current files in a known directory without needing to update
+# the mru list of files If the directory is chosen instead of the file within
+# it, it opens the directory with nnn
 pick() {
-	d=$(mru listdirs | dmenu -i -c -l 20 -p 'from')
+	d=$(printf "$(find $HOME -maxdepth 3 -not -path '*/.*' -not -name \
+	'node_modules' -not -name 'vendor'; find /mnt/media -maxdepth 3 -type d \
+	-not -path '*/.*')" | dmenu -i -c -l 20 -p 'from')
+
 	if [ -z "$d" ]; then exit; fi
+
 	f=$(
-	(printf "$d\n"; find "$d" -type f -not \( -path '*/.*/*' -o -path '*node_modules/*' -o -ipath '*backups/my-plugins*' -o -ipath '*/.uuid' -ipath '*.swp*' \)) |
+	(printf "$d\n"; find "$d" -type f -not \( -path '*/.*/*' -o -path \
+	'*node_modules/*' -o -ipath '*/.uuid' -ipath '*.swp*' \)) | \
 		dmenu -i -c -l 20 -p 'pick file'
 	)
+
 	if [ -z "$f" ]; then exit; fi
+
 	if [ "$d" = "$f" ]; then st -t 'Files' -e sh -lc "nnn '$f'"; exit; fi
 	xdg-open "$f"
 }
diff --git a/setup-xbindkeys b/setup-xbindkeys
index 65e2980..32737d4 100755
--- a/setup-xbindkeys
+++ b/setup-xbindkeys
@@ -1,4 +1,4 @@
 #!/bin/sh
 
 killall xbindkeys
-xbindkeys -f $BACKUPS_PATH/configs/xbindkeysrc
+xbindkeys -f $HOME/Source/configs/xbindkeysrc