diff options
-rwxr-xr-x | mprisctl | 27 |
1 files changed, 22 insertions, 5 deletions
@@ -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") |