#!/bin/sh readonly SINK=@DEFAULT_AUDIO_SINK@ stdbuf -oL amixer events \ | stdbuf -oL sed 's/event value: //' \ | while IFS= read -r line do IFS='=,' set -- $line x=${6#\'} x=${x%\'} case "$x" in 'Master Playback'*) wpctl get-volume $SINK \ | awk ' /MUTED/ { print "icon=" print "percentage=Muted" exit } { printf "icon=" if ($2 < 0.33) print "" else if ($2 <= 0.66) print "" else print "" printf "percentage=%s%d%%\n", pad, $2 * 100 } ' \ | jo ;; esac done