summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2023-02-27 00:14:48 -0600
committerzachir <zachir@librem.one>2023-02-27 00:14:48 -0600
commit04c0f463aa788b99b511e952a040cf0def2cb4fa (patch)
tree95e5ca7013a2f290cd545bd5ec763853c736f616
parent42feda400d8fd77e460aacca9e99af70c188b7c9 (diff)
update mprisctl to use bemenu; check for display server without flags
-rwxr-xr-xmprisctl17
1 files changed, 13 insertions, 4 deletions
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