From 45fcc996ee082b40ad9200b7266fe2253c9f874d Mon Sep 17 00:00:00 2001 From: zachir Date: Fri, 24 Feb 2023 10:30:40 -0600 Subject: add -w and -x flags for display servers --- mprisctl | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'mprisctl') diff --git a/mprisctl b/mprisctl index f9cb5a3..f63bb59 100755 --- a/mprisctl +++ b/mprisctl @@ -1,6 +1,23 @@ #!/bin/sh -DMENU_PROMPT=$(playerctl -l | barmenu -p 'Players:') +printhelp () { + exit +} + +while getopts "hwxd:" o; do case "${o}" in + w) + DMENU="tofi" + DEFARGS="--prompt-text" + ;; + x) + DMENU="dmenu" + DEFARGS="-p" + ;; + d) ARGS="$ARGS$OPTARG " ;; + *) printhelp ;; +esac done + +DMENU_PROMPT=$(playerctl -l | $DMENU $ARGS $DEFARGS 'Players:') [ -z "$DMENU_PROMPT" ] && exit 1 PLAYERCONTROLS_PROMPT=$(echo "play-pause @@ -12,7 +29,7 @@ previous position volume status -shuffle" | barmenu -p 'Action:') +shuffle" | $DMENU $ARGS $DEFARGS 'Action:') [ -z "$PLAYERCONTROLS_PROMPT" ] && exit 1 case "$PLAYERCONTROLS_PROMPT" in @@ -20,12 +37,12 @@ case "$PLAYERCONTROLS_PROMPT" in playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT" ;; "position") - VALUE=$(seq -100 5 +100 | grep -v '^0$' | sed 's/^[0-9]/\+&/' | barmenu -p 'Position:') + VALUE=$(seq -100 5 +100 | grep -v '^0$' | sed 's/^[0-9]/\+&/' | $DMENU $ARGS $DEFARGS 'Position:') [ -z "$VALUE" ] && exit 1 playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT" "$VALUE" ;; "volume") - VALUE=$(set 0 5 100 |barmenu -p 'Volume:') + VALUE=$(set 0 5 100 |$DMENU $ARGS $DEFARGS 'Volume:') [ -z "$VALUE" ] && exit 1 playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT" "$VALUE" ;; @@ -37,7 +54,7 @@ case "$PLAYERCONTROLS_PROMPT" in VALUE=$(echo "On Off Toggle -Status" | barmenu -p "Shuffle:") +Status" | $DMENU $ARGS $DEFARGS "Shuffle:") [ -z "$VALUE" ] && exit 1 case "$VALUE" in "On"|"Off"|"Toggle") -- cgit v1.2.3