From 187a18feb73ac9a1513a6100a1ffdb5f29f3debe Mon Sep 17 00:00:00 2001 From: zachir Date: Mon, 27 Feb 2023 00:21:09 -0600 Subject: change dmenu books, mount/umount, unicode to use bemenu and not need -w -x flag --- dmenuumount | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'dmenuumount') 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 ;; -- cgit v1.2.3