diff options
author | zachir <zachir@librem.one> | 2023-02-27 00:21:09 -0600 |
---|---|---|
committer | zachir <zachir@librem.one> | 2023-02-27 00:21:09 -0600 |
commit | 187a18feb73ac9a1513a6100a1ffdb5f29f3debe (patch) | |
tree | ecbb010c74cc97035c1c091003a4937355d3a01f /dmenuumount | |
parent | 7a1beb8c5d4ce12dd7ede3c4407617f0e81f5a43 (diff) |
change dmenu books, mount/umount, unicode to use bemenu and not need -w -x flag
Diffstat (limited to 'dmenuumount')
-rwxr-xr-x | dmenuumount | 19 |
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 ;; |