#!/bin/bash

# Get current volume percentage
get_volume() {
    pactl get-sink-volume @DEFAULT_SINK@ | grep -oP '\d+%' | head -1 | tr -d '%'
}

# Output initial volume
get_volume

# Subscribe to volume changes
pactl subscribe | grep --line-buffered "sink" | while read -r line; do
    get_volume
done
