summaryrefslogtreecommitdiff
path: root/dmenuumount
diff options
context:
space:
mode:
Diffstat (limited to 'dmenuumount')
-rwxr-xr-xdmenuumount19
1 files changed, 15 insertions, 4 deletions
diff --git a/dmenuumount b/dmenuumount
index 836bded..b4785cf 100755
--- a/dmenuumount
+++ b/dmenuumount
@@ -9,28 +9,39 @@ printhelp () {
}
while getopts "hwxd:" o; do case "${o}" in
- w) DMENU="tofi" ;;
+ w) DMENU="bemenu" ;;
x) DMENU="dmenu" ;;
d) ARGS="$ARGS$OPTARG " ;;
*) printhelp ;;
esac done
+if [ -z "$DMENU" ]; then
+ if [ -n "$WAYLAND_DISPLAY" ]; then
+ DMENU="bemenu"
+ elif [ -n "$DISPLAY" ]; then
+ DMENU="dmene"
+ else
+ print "Can't tell if Wayland or X; what gives?\n"
+ exit 1
+ fi
+fi
+
unmountusb() {
[ -z "$drives" ] && exit
- chosen="$(echo "$drives" | $DMENU $ARGS -p "Unmount which drive?")" || exit 1
+ chosen="$(echo "$drives" | $DMENU -l 10 $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 $ARGS -p "Unmount which device?")" || exit 1
+ chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | $DMENU -l 10 $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 $ARGS -p "Unmount a USB drive or Android device?")" || exit 1
+ choice="$(printf "USB\\nAndroid" | $DMENU -l 10 $ARGS -p "Unmount a USB drive or Android device?")" || exit 1
case "$choice" in
USB) unmountusb ;;
Android) unmountandroid ;;