Fixed wob
This commit is contained in:
parent
b532a2b8f4
commit
29e0e5db25
8 changed files with 52 additions and 11 deletions
17
themes/hacker/.config/sway/wob.sh
Executable file
17
themes/hacker/.config/sway/wob.sh
Executable file
|
|
@ -0,0 +1,17 @@
|
|||
#!/bin/bash
|
||||
# Wait for pipewire/pulseaudio to be ready
|
||||
until pactl info &>/dev/null; do
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
WOB_SOCK="${XDG_RUNTIME_DIR}/wob.sock"
|
||||
|
||||
pactl subscribe 2>/dev/null | grep --line-buffered "sink" | while read -r _; do
|
||||
vol=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -oP '\d+(?=%)' | head -1)
|
||||
muted=$(pactl get-sink-mute @DEFAULT_SINK@ | grep -c yes)
|
||||
if [ "$muted" -gt 0 ]; then
|
||||
echo 0 > "$WOB_SOCK"
|
||||
else
|
||||
echo "$vol" > "$WOB_SOCK"
|
||||
fi
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue