diff options
author | zachir <zachir@librem.one> | 2025-07-15 17:56:01 -0500 |
---|---|---|
committer | zachir <zachir@librem.one> | 2025-07-15 17:56:01 -0500 |
commit | 02446ea71c3a37dca44316ed42b00e22692e34b9 (patch) | |
tree | 7f1f4c1d24f1a5d41801b84c0bc0e826c9262515 | |
parent | c9d939e8e9d7845233820952276178c24a5914cf (diff) |
Replace all menus with dmenu
-rwxr-xr-x | dmenu_books | 12 | ||||
-rwxr-xr-x | dmenumount | 23 | ||||
-rwxr-xr-x | dmenuumount | 12 | ||||
-rwxr-xr-x | dmenuunicode | 6 |
4 files changed, 11 insertions, 42 deletions
diff --git a/dmenu_books b/dmenu_books index 8017437..3b6f1fe 100755 --- a/dmenu_books +++ b/dmenu_books @@ -9,16 +9,8 @@ while getopts "hd:" o; do case "${o}" in *) printhelp ;; esac done -if [ -n "$WAYLAND_DISPLAY" ]; then - DMENU="tofi" - DEFARGS="-c $HOME/.config/tofi/themes/dmenu_vertical --prompt-text" -elif [ -n "$DISPLAY" ]; then - DMENU="dmenu" - DEFARGS="-l 15 -p" -else - print "Can't tell if Wayland or X; what gives?\n" - exit 1 -fi +DMENU="dmenu" +DEFARGS="-l 15 -p" BOOK=`ls ~/Documents/shared | $DMENU $DEFARGS \"books\" $ARGS` @@ -14,30 +14,19 @@ while getopts "hd:" o; do case "${o}" in *) printhelp ;; esac done -if [ -n "$WAYLAND_DISPLAY" ]; then - DMENU="tofi" - DEFARGS="-c $HOME/.config/tofi/themes/dmenu_vertical --prompt-text" -elif [ -n "$DISPLAY" ]; then - DMENU="dmenu" - DEFARGS="-l 10 -p" -else - print "Can't tell if Wayland or X; what gives?\n" - exit 1 -fi - getmount() { \ [ -z "$chosen" ] && exit 1 # shellcheck disable=SC2086 - mp="$(find $1 2>/dev/null | $DMENU $DEFARGS "Type in mount point." $ARGS)" || exit 1 + mp="$(find $1 2>/dev/null | dmenu -l 15 -p "Type in mount point." $ARGS)" || exit 1 test -z "$mp" && exit 1 if [ ! -d "$mp" ]; then - mkdiryn=$(printf "No\\nYes" | $DMENU $DEFARGS "$mp does not exist. Create it?" $ARGS) || exit 1 + mkdiryn=$(printf "No\\nYes" | dmenu -l 15 -p "$mp does not exist. Create it?" $ARGS) || exit 1 [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo mkdir -p "$mp") fi } mountusb() { \ - chosen="$(echo "$usbdrives" | $DMENU $DEFARGS "Mount which drive?" $ARGS)" || exit 1 + chosen="$(echo "$usbdrives" | dmenu -l 15 -p "Mount which drive?" $ARGS)" || exit 1 chosen="$(echo "$chosen" | awk '{print $1}')" echo "$chosen" sudo mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0 @@ -53,17 +42,17 @@ mountusb() { \ } mountandroid() { \ - chosen="$(echo "$anddrives" | $DMENU $DEFARGS "Which Android device?" $ARGS)" || exit 1 + chosen="$(echo "$anddrives" | dmenu -l 15 -p "Which Android device?" $ARGS)" || exit 1 chosen="$(echo "$chosen" | cut -d : -f 1)" getmount "$HOME -maxdepth 3 -type d" simple-mtpfs --device "$chosen" "$mp" - echo "OK" | $DMENU $DEFARGS "Tap Allow on your phone if it asks for permission and then press enter" $ARGS || exit 1 + echo "OK" | dmenu -l 15 -p "Tap Allow on your phone if it asks for permission and then press enter" $ARGS || exit 1 simple-mtpfs --device "$chosen" "$mp" notify-send "🤖 Android Mounting" "Android device mounted to $mp." } asktype() { \ - choice="$(printf "USB\\nAndroid" | $DMENU $DEFARGS "Mount a USB drive or Android device?" $ARGS)" || exit 1 + choice="$(printf "USB\\nAndroid" | dmenu -l 15 -p "Mount a USB drive or Android device?" $ARGS)" || exit 1 case $choice in USB) mountusb ;; Android) mountandroid ;; diff --git a/dmenuumount b/dmenuumount index 6dc25e2..b8da40b 100755 --- a/dmenuumount +++ b/dmenuumount @@ -13,16 +13,8 @@ while getopts "hd:" o; do case "${o}" in *) printhelp ;; esac done -if [ -n "$WAYLAND_DISPLAY" ]; then - DMENU="tofi" - DEFARGS="-c $HOME/.config/tofi/themes/dmenu_vertical --prompt-text" -elif [ -n "$DISPLAY" ]; then - DMENU="dmenu" - DEFARGS="-l 15 -p" -else - print "Can't tell if Wayland or X; what gives?\n" - exit 1 -fi +DMENU="dmenu" +DEFARGS="-l 15 -p" unmountusb() { [ -z "$drives" ] && exit diff --git a/dmenuunicode b/dmenuunicode index 1769cb6..c843353 100755 --- a/dmenuunicode +++ b/dmenuunicode @@ -12,12 +12,8 @@ while getopts "hd:" o; do case "${o}" in esac done if [ -n "$WAYLAND_DISPLAY" ]; then - DMENU="tofi" - DEFARGS="-c $HOME/.config/tofi/themes/dmenu_vertical" CLIP="wl-copy" elif [ -n "$DISPLAY" ]; then - DMENU="dmenu " - DEFARGS="-l 10" CLIP="xclip -selection clipboard" else print "Can't tell if Wayland or X; what gives?\n" @@ -25,7 +21,7 @@ else fi # Get user selection via dmenu -i -l 30 from emoji file. -chosen=$(cut -d ';' -f1 ~/.local/share/larbs/chars/* | $DMENU $DEFARGS $ARGS | sed "s/ .*//") +chosen=$(cut -d ';' -f1 ~/.local/share/larbs/chars/* | dmenu -l 15 $ARGS | sed "s/ .*//") # Exit if none chosen. [ -z "$chosen" ] && exit |