summaryrefslogtreecommitdiff
path: root/play-pause.sh
blob: 90351aafb70ea64fec4c53e46d2bb6416a7fb534 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

WORKSPACE=$(hyprctl activeworkspace -j | jq '.id')
WWORKSPACE=$(hyprctl clients -j | jq -r '.[] | select(.class == "zen") | .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
else
    playerctl -p spotify play-pause
fi