#!/bin/sh
# prefix_cmd for the volume module -- picks a Nerd Font glyph based on level
# and mute state.
# $1 is the volume module's own output (e.g. "40%"); the built-in command
# strips the [MUTED] marker to keep the number clean, so we re-check wpctl
# ourselves here.
pct=$(printf '%s' "$1" | tr -dc '0-9')
pct=${pct:-0}
muted=$(LC_ALL=C wpctl get-volume @DEFAULT_AUDIO_SINK@ 2>/dev/null | grep -c MUTED)

if [ "$muted" -gt 0 ]; then
    printf '%s ' ''
elif [ "$pct" -ge 50 ]; then
    printf '%s ' ''
else
    printf '%s ' ''
fi
