summaryrefslogtreecommitdiff
path: root/mprisctl-tofi
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2022-10-09 00:42:32 -0500
committerzachir <zachir@librem.one>2022-10-09 00:42:32 -0500
commit0217995cda2e5b3700b911b5561e99c659fba92b (patch)
tree80abdcf81366ebf51432b406e5e0e3293930cf8f /mprisctl-tofi
parent5355ec2d7e7e79d636e62b70af7dbb39002e98d3 (diff)
add tofi scripts, replacing barmenu
Diffstat (limited to 'mprisctl-tofi')
-rwxr-xr-xmprisctl-tofi59
1 files changed, 59 insertions, 0 deletions
diff --git a/mprisctl-tofi b/mprisctl-tofi
new file mode 100755
index 0000000..f8c3691
--- /dev/null
+++ b/mprisctl-tofi
@@ -0,0 +1,59 @@
+#!/sbin/sh
+
+DMENU_PROMPT=$(playerctl -l | tofi --prompt 'Players:')
+[ -z "$DMENU_PROMPT" ] && exit 1
+
+PLAYERCONTROLS_PROMPT=$(echo "play
+pause
+play-pause
+stop
+next
+previous
+position
+volume
+status
+shuffle" | tofi --prompt 'Action:')
+[ -z "$PLAYERCONTROLS_PROMPT" ] && exit 1
+
+case "$PLAYERCONTROLS_PROMPT" in
+ "pause"|"play"|"play-pause"|"stop"|"next"|"previous")
+ playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT"
+ ;;
+ "position")
+ VALUE=$(seq -100 5 +100 | grep -v '^0$' | sed 's/^[0-9]/\+&/' | tofi --prompt 'Position:')
+ [ -z "$VALUE" ] && exit 1
+ playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT" "$VALUE"
+ ;;
+ "volume")
+ VALUE=$(set 0 5 100 |tofi --prompt 'Volume:')
+ [ -z "$VALUE" ] && exit 1
+ playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT" "$VALUE"
+ ;;
+ "status")
+ STATUS_MSG=$(playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT")
+ notify-send "$DMENU_PROMPT status" "$STATUS_MSG"
+ ;;
+ "shuffle")
+ VALUE=$(echo "On
+Off
+Toggle
+Status" | tofi --prompt "Shuffle:")
+ [ -z "$VALUE" ] && exit 1
+ case "$VALUE" in
+ "On"|"Off"|"Toggle")
+ playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT" "$VALUE"
+ ;;
+ "Status")
+ STATUS_MSG=$(playerctl -p "$DMENU_PROMPT" "$PLAYERCONTROLS_PROMPT")
+ notify-send "$DMENU_PROMPT shuffle status" "$STATUS_MSG"
+ ;;
+ *)
+ exit 1
+ ;;
+ esac
+ ;;
+ *)
+ exit 1
+ ;;
+esac
+exit 0