From 6e72884bb5d0d046b37df86aedad33f0f60557f3 Mon Sep 17 00:00:00 2001 From: zachir Date: Wed, 16 Aug 2023 13:20:22 -0500 Subject: We use tofi now, it's fixed --- dmenu_books | 24 +++++++++++------------- dmenumount | 34 ++++++++++++++++------------------ dmenuumount | 28 +++++++++++++--------------- dmenuunicode | 24 +++++++++++------------- 4 files changed, 51 insertions(+), 59 deletions(-) diff --git a/dmenu_books b/dmenu_books index 130cbc9..8017437 100755 --- a/dmenu_books +++ b/dmenu_books @@ -4,25 +4,23 @@ printhelp () { exit } -while getopts "hwxd:" o; do case "${o}" in - w) DMENU="bemenu" ;; - x) DMENU="dmenu" ;; +while getopts "hd:" o; do case "${o}" in d) ARGS="$ARGS$OPTARG " ;; *) printhelp ;; esac done -if [ -z "$DMENU" ]; then - if [ -n "$WAYLAND_DISPLAY" ]; then - DMENU="bemenu" - elif [ -n "$DISPLAY" ]; then - DMENU="dmenu" - else - print "Can't tell if Wayland or X; what gives?\n" - exit 1 - fi +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 -BOOK=`ls ~/Documents/shared | $DMENU $ARGS` +BOOK=`ls ~/Documents/shared | $DMENU $DEFARGS \"books\" $ARGS` [ -z "$BOOK" ] && exit 1 diff --git a/dmenumount b/dmenumount index 9bd07d5..179781d 100755 --- a/dmenumount +++ b/dmenumount @@ -9,37 +9,35 @@ printhelp () { exit } -while getopts "wxhd:" o; do case "${o}" in - w) DMENU="bemenu" ;; - x) DMENU="dmenu" ;; +while getopts "hd:" o; do case "${o}" in d) ARGS="$ARGS$OPTARG " ;; *) printhelp ;; esac done -if [ -z "$DMENU" ]; then - if [ -n "$WAYLAND_DISPLAY" ]; then - DMENU="bemenu" - elif [ -n "$DISPLAY" ]; then - DMENU="dmenu" - else - print "Can't tell if Wayland or X; what gives?\n" - exit 1 - fi +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 -l 10 $ARGS -p "Type in mount point.")" || exit 1 + mp="$(find $1 2>/dev/null | $DMENU $DEFARGS "Type in mount point." $ARGS)" || exit 1 test -z "$mp" && exit 1 if [ ! -d "$mp" ]; then - mkdiryn=$(printf "No\\nYes" | $DMENU -l 10 $ARGS -p "$mp does not exist. Create it?") || exit 1 + mkdiryn=$(printf "No\\nYes" | $DMENU $DEFARGS "$mp does not exist. Create it?" $ARGS) || exit 1 [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || doas mkdir -p "$mp") fi } mountusb() { \ - chosen="$(echo "$usbdrives" | $DMENU -l 10 $ARGS -p "Mount which drive?")" || exit 1 + chosen="$(echo "$usbdrives" | $DMENU $DEFARGS "Mount which drive?" $ARGS)" || exit 1 chosen="$(echo "$chosen" | awk '{print $1}')" echo "$chosen" doas mount "$chosen" 2>/dev/null && notify-send "💻 USB mounting" "$chosen mounted." && exit 0 @@ -55,17 +53,17 @@ mountusb() { \ } mountandroid() { \ - chosen="$(echo "$anddrives" | $DMENU -l 10 $ARGS -p "Which Android device?")" || exit 1 + chosen="$(echo "$anddrives" | $DMENU $DEFARGS "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 -l 10 $ARGS -p "Tap Allow on your phone if it asks for permission and then press enter" || exit 1 + echo "OK" | $DMENU $DEFARGS "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 -l 10 $ARGS -p "Mount a USB drive or Android device?")" || exit 1 + choice="$(printf "USB\\nAndroid" | $DMENU $DEFARGS "Mount a USB drive or Android device?" $ARGS)" || exit 1 case $choice in USB) mountusb ;; Android) mountandroid ;; diff --git a/dmenuumount b/dmenuumount index 3b4ef61..4af0394 100755 --- a/dmenuumount +++ b/dmenuumount @@ -8,40 +8,38 @@ printhelp () { exit } -while getopts "hwxd:" o; do case "${o}" in - w) DMENU="bemenu" ;; - x) DMENU="dmenu" ;; +while getopts "hd:" o; do case "${o}" in d) ARGS="$ARGS$OPTARG " ;; *) printhelp ;; esac done -if [ -z "$DMENU" ]; then - if [ -n "$WAYLAND_DISPLAY" ]; then - DMENU="bemenu" - elif [ -n "$DISPLAY" ]; then - DMENU="dmenu" - else - print "Can't tell if Wayland or X; what gives?\n" - exit 1 - fi +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 unmountusb() { [ -z "$drives" ] && exit - chosen="$(echo "$drives" | $DMENU -l 10 $ARGS -p "Unmount which drive?")" || exit 1 + chosen="$(echo "$drives" | $DMENU $DEFARGS "Unmount which drive?" $ARGS)" || 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 -l 10 $ARGS -p "Unmount which device?")" || exit 1 + chosen="$(awk '/simple-mtpfs/ {print $2}' /etc/mtab | $DMENU $DEFARGS "Unmount which device?" $ARGS )" || exit 1 [ -z "$chosen" ] && exit doas umount -l "$chosen" && notify-send "🤖 Android unmounting" "$chosen unmounted." } asktype() { \ - choice="$(printf "USB\\nAndroid" | $DMENU -l 10 $ARGS -p "Unmount a USB drive or Android device?")" || exit 1 + choice="$(printf "USB\\nAndroid" | $DMENU $DEFARGS "Unmount a USB drive or Android device?" $ARGS)" || exit 1 case "$choice" in USB) unmountusb ;; Android) unmountandroid ;; diff --git a/dmenuunicode b/dmenuunicode index 4af8870..ef7a63d 100755 --- a/dmenuunicode +++ b/dmenuunicode @@ -6,26 +6,24 @@ printhelp () { exit } -while getopts "hwxd:" o; do case "${o}" in - w) DMENU="bemenu" ;; - x) DMENU="dmenu" ;; +while getopts "hd:" o; do case "${o}" in d) ARGS="$ARGS$OPTARG " ;; *) printhelp ;; esac done -if [ -z "$DMENU" ]; then - if [ -n "$WAYLAND_DISPLAY" ]; then - DMENU="bemenu" - elif [ -n "$DISPLAY" ]; then - DMENU="dmenu" - else - print "Can't tell if Wayland or X; what gives?\n" - exit 1 - fi +if [ -n "$WAYLAND_DISPLAY" ]; then + DMENU="tofi" + DEFARGS="-c $HOME/.config/tofi/themes/dmenu_vertical" +elif [ -n "$DISPLAY" ]; then + DMENU="dmenu " + DEFARGS="-l 10" +else + print "Can't tell if Wayland or X; what gives?\n" + exit 1 fi # Get user selection via dmenu -i -l 30 from emoji file. -chosen=$(cut -d ';' -f1 ~/.local/share/larbs/chars/* | $DMENU -l 10 $ARGS | sed "s/ .*//") +chosen=$(cut -d ';' -f1 ~/.local/share/larbs/chars/* | $DMENU $DEFARGS $ARGS | sed "s/ .*//") # Exit if none chosen. [ -z "$chosen" ] && exit -- cgit v1.2.3