summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-12-28 18:58:12 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-12-28 18:58:12 +0800
commitb70965b71c7a393030b1f6c006c874b7fa2b05ed (patch)
tree363ce21149e2f9470aaca6b7d6ce743d3696c2e0
parent76a2fcbebc5c531815efe9ca79723bcc85f58360 (diff)
change(play-pause): find window on whole workspace(for PIP)
-rwxr-xr-xplay-pause.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/play-pause.sh b/play-pause.sh
index 54ca7ea..91089af 100755
--- a/play-pause.sh
+++ b/play-pause.sh
@@ -1,6 +1,16 @@
#!/bin/bash
-if hyprctl activewindow | grep 'class: zen-alpha' > /dev/null; then
+WORKSPACE=$(hyprctl activeworkspace -j | jq '.id')
+WWORKSPACE=$(hyprctl clients -j | jq -r '.[] | select(.class == "zen-beta") | .workspace.name')
+
+while IFS= read -r line; do
+ if [[ "$line" == "$WORKSPACE" ]]; then
+ ACTIVE=true
+ break
+ fi
+done < <(echo "$WWORKSPACE")
+
+if [ $ACTIVE ]; then
playerctl -p spotify play-pause
elif [[ "$(playerctl status firefox)" == "Playing" ]]; then
playerctl --all-players pause