From afad25de6e51b617388a8367005215b5f46d784c Mon Sep 17 00:00:00 2001 From: zachir Date: Tue, 15 Jul 2025 17:51:51 -0500 Subject: Change all menus to dmenu --- bm | 15 +-------------- bsc | 15 +-------------- dmount | 25 +++++-------------------- fdc | 15 +-------------- ffc | 15 +-------------- lwc | 15 +-------------- mbc | 15 +-------------- mprisctl | 31 ++++++------------------------- qbc | 15 +-------------- scrshot | 10 ++-------- 10 files changed, 20 insertions(+), 151 deletions(-) diff --git a/bm b/bm index cff09fc..60bc29b 100755 --- a/bm +++ b/bm @@ -79,19 +79,6 @@ bra () { } #}}} -#{{{ Check display server if -w or -x not provided -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 -#}}} - #{{{ main if [ -n "$BSC$FDC$FFC$LWC$QBC" ]; then ARG="$ARG -u $URL" @@ -117,7 +104,7 @@ if [ -z "$CLIPB$BRA$BSC$FDC$FFC$LWC$MBC$QBC" ]; then echo "$BROWSERSINSTALLED" [ -z "$BROWSERSINSTALLED" ] && \ printf "No suitable browsers!\n" && exit 1 - BROWSERSEL="$(printf "$BROWSERSINSTALLED" | $DMENU $DEFARGS "browser?" $ARG)" + BROWSERSEL="$(printf "$BROWSERSINSTALLED" | dmenu -l 10 -p "browser?" $ARG)" [ -z "$BROWSERSEL" ] && \ printf "No browser selected!\n" && exit 1 case "$BROWSERSEL" in diff --git a/bsc b/bsc index 3752954..22973cf 100755 --- a/bsc +++ b/bsc @@ -17,22 +17,9 @@ while getopts "hd:u:" o; do case "${o}" in esac done #}}} -#{{{ Check display server if -w or -x not provided -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 -#}}} - #{{{ Choose Profiles PROFILES=`grep 'Path=' ~/.moonchild\ productions/basilisk/profiles.ini | cut -d'.' -f2` -CHOSEN=`echo "$PROFILES" | $DMENU $DEFARGS "basilisk" $DMENU_ARGS` +CHOSEN=`echo "$PROFILES" | dmenu -l 15 -p "basilisk" $DMENU_ARGS` [ -z "$CHOSEN" ] && exit 2 exec basilisk -P "$CHOSEN" $URL #}}} diff --git a/dmount b/dmount index 164b233..06f07a9 100755 --- a/dmount +++ b/dmount @@ -31,21 +31,6 @@ esac done IS_HFS="" -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 - error_msg "Can't tell if Wayland or Xorg; is there a display server?" -fi - -case "$DMENU" in - dmenu) PASSARG="-P" ;; - tofi) PASSARG="--hide-input=true" ;; -esac - check_crypto () { [ "$(lsblk -oFSTYPE "$1" | wc -l)" -gt 2 ] && printf "y" } @@ -55,8 +40,8 @@ is_crypto () { } unlock_crypto () { - NAME="$(cat /dev/null | $DMENU $DEFARGS "Name" $ARGS)" - PASSWORD="$(cat /dev/null | $DMENU $DEFARGS "Password" $PASSARG $ARGS)" + NAME="$(cat /dev/null | dmenu -l 15 -p "Name" $ARGS)" + PASSWORD="$(cat /dev/null | dmenu -l 15 -p "Password" $PASSARG $ARGS)" echo "$PASSWORD" | sudo cryptsetup open "$1" "$NAME" || FAILED="y" unset PASSWORD [ -n "$FAILED" ] && \ @@ -79,11 +64,11 @@ get_available () { lsblk -oPATH,SIZE,FSTYPE,MOUNTPOINT | tail -n+2 | while read getmount() { \ [ -z "$chosen" ] && exit 1 # shellcheck disable=SC2086 - mp="$(find $1 2>/dev/null | $DMENU $ARGS $DEFARGS "Type in mount point.")" || error_msg "Canceled; no mount point chosen." + mp="$(find $1 2>/dev/null | dmenu $ARGS -l 15 -p "Type in mount point.")" || error_msg "Canceled; no mount point chosen." test -z "$mp" && \ exit 1 if [ ! -d "$mp" ]; then - mkdiryn=$(printf "No\\nYes" | $DMENU $ARGS $DEFARGS "$mp does not exist. Create it?") || \ + mkdiryn=$(printf "No\\nYes" | dmenu $ARGS -l 15 -p "$mp does not exist. Create it?") || \ exit 1 [ "$mkdiryn" = "Yes" ] && (mkdir -p "$mp" || sudo mkdir -p "$mp") fi @@ -113,7 +98,7 @@ mount_device () { sudo mount $MOUNTARGS $MOUNTPROPS "$1" "$mp" && show "Mounted successfully\n" } -DEVICE="$(get_available | $DMENU $DEFARGS "Devices" $ARGS )" +DEVICE="$(get_available | dmenu -l 15 -p "Devices" $ARGS )" [ -z "$DEVICE" ] && exit 1 echo "$DEVICE" | grep -q "hfsplus" && IS_HFS="y" chosen="${DEVICE%% *}" diff --git a/fdc b/fdc index a2b75ec..1437c2b 100755 --- a/fdc +++ b/fdc @@ -17,22 +17,9 @@ while getopts "hd:u:" o; do case "${o}" in esac done #}}} -#{{{ Check display server if -w or -x not provided -if [ -n "$WAYLAND_DISPLAY" ]; then - DMENU="tofi" - DEFARGS="-c $HOME/.config/tofi/themes/dmenu_vertical --prompt-text" -elif [ -n "$DISPLAY" ]; then - DMENU="dmenu" - DEFARGS="" -else - print "Can't tell if Wayland or X; what gives?\n" - exit 1 -fi -#}}} - #{{{ Choose Profiles PROFILES=`grep 'Path=' ~/.firedragon/profiles.ini | cut -d'.' -f2` -CHOSEN=`echo "$PROFILES" | $DMENU $DEFARGS "firedragon" $DMENU_ARGS` +CHOSEN=`echo "$PROFILES" | dmenu $DMENU_ARGS -p "firedragon"` [ -z "$CHOSEN" ] && exit 2 exec firedragon -P "$CHOSEN" $URL #}}} diff --git a/ffc b/ffc index 2b521d2..b40ec75 100755 --- a/ffc +++ b/ffc @@ -17,19 +17,6 @@ while getopts "hd:u:" o; do case "${o}" in esac done #}}} -#{{{ Check display server if -w or -x not provided -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 -#}}} - #{{{ Native Profiles if [ -f ~/.mozilla/firefox/profiles.ini ]; then NATIVE_PROFILES=`grep 'Path=' ~/.mozilla/firefox/profiles.ini | cut -d'.' -f2` @@ -54,7 +41,7 @@ PROFILES="$NATIVE_PROFILES$INT$FLATPAK_PROFILES" #}}} #{{{ Choose Profiles -CHOSEN=`printf "$PROFILES" | $DMENU $DEFARGS "firefox" $DMENU_ARGS` +CHOSEN=`printf "$PROFILES" | dmenu -l 15 -p "firefox" $DMENU_ARGS` [ -z "$CHOSEN" ] && exit 2 if `echo "$CHOSEN" | grep -qE ' F$'`; then exec flatpak run org.mozilla.Firefox -P `echo "$CHOSEN" | sed 's/ F$//'` $URL diff --git a/lwc b/lwc index 78b33e1..c4c70c2 100755 --- a/lwc +++ b/lwc @@ -17,19 +17,6 @@ while getopts "hd:u:" o; do case "${o}" in esac done #}}} -#{{{ Check display server if -w or -x not provided -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 -#}}} - #{{{ Native Profiles if [ -f ~/.librewolf/profiles.ini ]; then NATIVE_PROFILES=`grep 'Path=' ~/.librewolf/profiles.ini | cut -d'.' -f2` @@ -54,7 +41,7 @@ PROFILES="$NATIVE_PROFILES$INT$FLATPAK_PROFILES" #}}} #{{{ Choose Profiles -CHOSEN=`printf "$PROFILES" | $DMENU $DEFARGS librewolf $DMENU_ARGS` +CHOSEN=`printf "$PROFILES" | dmenu -l 15 -p librewolf $DMENU_ARGS` [ -z "$CHOSEN" ] && exit 2 if `echo "$CHOSEN" | grep -qE ' F$'`; then exec flatpak run io.gitlab.librewolf-community -P `echo "$CHOSEN" | sed 's/ F$//'` $URL diff --git a/mbc b/mbc index a429e47..292c3e3 100755 --- a/mbc +++ b/mbc @@ -17,19 +17,6 @@ while getopts "hd:u:" o; do case "${o}" in esac done #}}} -#{{{ Check display server if -w or -x not provided -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 -#}}} - #{{{ Native Profiles if [ -f ~/.mullvad/mullvadbrowser/profiles.ini ]; then NATIVE_PROFILES=`grep 'Path=' ~/.mullvad/mullvadbrowser/profiles.ini | cut -d'.' -f2` @@ -46,7 +33,7 @@ PROFILES="$NATIVE_PROFILES" #}}} #{{{ Choose Profiles -CHOSEN=`printf "$PROFILES" | $DMENU $DEFARGS "mullvad-browser" $DMENU_ARGS` +CHOSEN=`printf "$PROFILES" | dmenu -l 15 -p "mullvad-browser" $DMENU_ARGS` [ -z "$CHOSEN" ] && exit 2 exec mullvad-browser -P "$CHOSEN" $URL #}}} diff --git a/mprisctl b/mprisctl index ce03642..b784523 100755 --- a/mprisctl +++ b/mprisctl @@ -4,31 +4,12 @@ printhelp () { exit } -while getopts "hwxd:" o; do case "${o}" in - w) - DMENU="tofi" - ;; - 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="tofi" - DEFARGS="--prompt-text" - elif [ -n "$DISPLAY" ]; then - DMENU="dmenu" - DEFARGS="-p" - else - printf "Can't tell if Wayland or X; what gives?\n" - exit 1 - fi -fi - -DMENU_PROMPT=$(playerctl -l | $DMENU $ARGS $DEFARGS 'Players:') +DMENU_PROMPT=$(playerctl -l | dmenu $ARGS -p 'Players:') [ -z "$DMENU_PROMPT" ] && exit 1 PLAYERCONTROLS_PROMPT=$(echo "play-pause @@ -40,7 +21,7 @@ previous position volume status -shuffle" | $DMENU $ARGS $DEFARGS 'Action:') +shuffle" | dmenu $ARGS -p 'Action:') [ -z "$PLAYERCONTROLS_PROMPT" ] && exit 1 case "$PLAYERCONTROLS_PROMPT" in @@ -48,12 +29,12 @@ case "$PLAYERCONTROLS_PROMPT" in playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT" ;; "position") - VALUE=$(seq -100 5 +100 | grep -v '^0$' | sed 's/^[0-9]/\+&/' | $DMENU $ARGS $DEFARGS 'Position:') + VALUE=$(seq -100 5 +100 | grep -v '^0$' | sed 's/^[0-9]/\+&/' | dmenu $ARGS -p 'Position:') [ -z "$VALUE" ] && exit 1 playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT" "$VALUE" ;; "volume") - VALUE=$(set 0 5 100 |$DMENU $ARGS $DEFARGS 'Volume:') + VALUE=$(set 0 5 100 |dmenu $ARGS -p 'Volume:') [ -z "$VALUE" ] && exit 1 playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT" "$VALUE" ;; @@ -65,7 +46,7 @@ case "$PLAYERCONTROLS_PROMPT" in VALUE=$(echo "On Off Toggle -Status" | $DMENU $ARGS $DEFARGS "Shuffle:") +Status" | dmenu $ARGS -p "Shuffle:") [ -z "$VALUE" ] && exit 1 case "$VALUE" in "On"|"Off"|"Toggle") diff --git a/qbc b/qbc index b423141..b0dad2e 100755 --- a/qbc +++ b/qbc @@ -17,26 +17,13 @@ while getopts "hd:u:" o; do case "${o}" in esac done #}}} -#{{{ Check display server if -w or -x not provided -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 -#}}} - #{{{ Get Sessions SESSIONS=`qbpm list` [ -z "$SESSIONS" ] && qutebrowser $@ && exit #}}} #{{{ Select Session -CHOSEN=`printf "default\n$SESSIONS" | $DMENU $DEFARGS "qutebrowser" $DMENU_ARGS` +CHOSEN=`printf "default\n$SESSIONS" | dmenu -l 15 -p "qutebrowser" $DMENU_ARGS` [ -z "$CHOSEN" ] && exit 2 if [ -n "$CHOSEN" ]; then if [ "$CHOSEN" = "default" ]; then diff --git a/scrshot b/scrshot index 77174e6..8982b56 100755 --- a/scrshot +++ b/scrshot @@ -7,11 +7,9 @@ output_text () { while getopts "hwxd:s:o:" o; do case "${o}" in w) - DMENU="tofi" SCRSH="grim" ;; x) - DMENU="dmenu" SCRSH="maim" ;; d) DARG="$OPTARG $DARG" ;; @@ -19,14 +17,10 @@ while getopts "hwxd:s:o:" o; do case "${o}" in o) FILENAME="$OPTARG" ;; esac done -if [ -z "$DMENU" ]; then +if [ -z "$SCRSH" ]; then if [ -n "$WAYLAND_DISPLAY" ]; then - DMENU="tofi" - DEFARGS="--prompt-text" SCRSH="grim" elif [ -n "$DISPLAY" ]; then - DMENU="dmenu" - DEFARGS="-p" SCRSH="maim" else output_text "Stuck" "Can't tell if Wayland or X, what gives?" @@ -43,7 +37,7 @@ sleep 0.1 "$SCRSH" $SARG "$TEMPFILE" if [ -z "$FILENAME" ]; then - FILENAME="$(echo "$TEMPFILE" | $DMENU $DARGS $DEFARGS "What to name the file?")" + FILENAME="$(echo "$TEMPFILE" | dmenu $DARGS -p "What to name the file?")" if [ -z "$FILENAME" ]; then rm -rf "$TEMPFILE" output_text "Deleted" "No filename selected, file deleted!" -- cgit v1.2.3