#!/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