Files
dotfiles-archive/nixos/scripts/get-volume
T
2025-02-27 17:06:42 +00:00

23 lines
473 B
Bash
Executable File

#!/bin/sh
# Dependencies: pactl, awk
volume=$(pactl list sinks | awk '/^\s+Volume:/ {print $5}' | head -n 1 | tr -d '%')
muted=$(pactl list sinks | awk '/^\s+Mute:/ {print $2}' | head -n 1)
if [ "$muted" = "yes" ]; then
icon="󰝟"
else
if [ "$volume" -le 20 ]; then
icon="󰕿"
elif [ "$volume" -le 50 ]; then
icon="󰖀"
elif [ "$volume" -le 100 ]; then
icon="󰕾"
else
icon="󰝝"
fi
fi
echo "$icon $volume%"