diff options
author | zachir <zachir@librem.one> | 2023-02-24 10:27:34 -0600 |
---|---|---|
committer | zachir <zachir@librem.one> | 2023-02-24 10:27:34 -0600 |
commit | 25af7059733a3f5fe0272d5fdb90f7e2faf54f2d (patch) | |
tree | 8b3eae9a166d93ff4eed47655a6917f0c664fd80 /dmenuumount | |
parent | cb1ba09b2a36767afea74460947963542a04be53 (diff) |
add -w and -x flags for dmenu scripts (tofi vs dmenu)
Diffstat (limited to 'dmenuumount')
-rwxr-xr-x | dmenuumount | 17 |
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 ;; |