From b70965b71c7a393030b1f6c006c874b7fa2b05ed Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 28 Dec 2024 18:58:12 +0800 Subject: change(play-pause): find window on whole workspace(for PIP) --- play-pause.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3