summaryrefslogtreecommitdiff
path: root/dmenuumount
diff options
context:
space:
mode:
Diffstat (limited to 'dmenuumount')
-rwxr-xr-xdmenuumount17
1 files changed, 14 insertions, 3 deletions
diff --git a/dmenuumount b/dmenuumount
index 0584cb4..836bded 100755
--- a/dmenuumount
+++ b/dmenuumount
@@ -4,22 +4,33 @@
# Provides you with mounted partitions, select one to unmount.
# Drives mounted at /, /boot and /home will not be options to unmount.
+printhelp () {
+ exit
+}
+
+while getopts "hwxd:" o; do case "${o}" in
+ w) DMENU="tofi" ;;
+ x) DMENU="dmenu" ;;
+ d) ARGS="$ARGS$OPTARG " ;;
+ *) printhelp ;;
+esac done
+
unmountusb() {
[ -z "$drives" ] && exit
- chosen="$(echo "$drives" | dmenu -p "Unmount which drive?")" || exit 1
+ chosen="$(echo "$drives" | $DMENU $ARGS -p "Unmount which drive?")" || exit 1
chosen="$(echo "$chosen" | awk '{print $1}')"
[ -z "$chosen" ] && exit
doas umount "$chosen" && notify-send "💻 USB unmounting" "$chosen unmounted."
}
unmountandroid() { \
- chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | dmenu -p "Unmount which device?")" || exit 1
+ chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | $DMENU $ARGS -p "Unmount which device?")" || exit 1
[ -z "$chosen" ] && exit
doas umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted."
}
asktype() { \
- choice="$(printf "USB\\nAndroid" | dmenu -p "Unmount a USB drive or Android device?")" || exit 1
+ choice="$(printf "USB\\nAndroid" | $DMENU $ARGS -p "Unmount a USB drive or Android device?")" || exit 1
case "$choice" in
USB) unmountusb ;;
Android) unmountandroid ;;