From 04c0f463aa788b99b511e952a040cf0def2cb4fa Mon Sep 17 00:00:00 2001 From: zachir Date: Mon, 27 Feb 2023 00:14:48 -0600 Subject: update mprisctl to use bemenu; check for display server without flags --- mprisctl | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'mprisctl') diff --git a/mprisctl b/mprisctl index f63bb59..0685de7 100755 --- a/mprisctl +++ b/mprisctl @@ -6,18 +6,27 @@ printhelp () { while getopts "hwxd:" o; do case "${o}" in w) - DMENU="tofi" - DEFARGS="--prompt-text" + DMENU="bemenu" ;; x) DMENU="dmenu" - DEFARGS="-p" ;; d) ARGS="$ARGS$OPTARG " ;; *) printhelp ;; esac done -DMENU_PROMPT=$(playerctl -l | $DMENU $ARGS $DEFARGS 'Players:') +if [ -z "$DMENU" ]; then + if [ -n "$WAYLAND_DISPLAY" ]; then + DMENU="bemenu" + elif [ -n "$DISPLAY" ]; then + DMENU="dmenu" + else + printf "Can't tell if Wayland or X; what gives?\n" + exit 1 + fi +fi + +DMENU_PROMPT=$(playerctl -l | $DMENU $ARGS -p 'Players:') [ -z "$DMENU_PROMPT" ] && exit 1 PLAYERCONTROLS_PROMPT=$(echo "play-pause -- cgit v1.2.3