added audio scripts used in my river configuration

This commit is contained in:
2025-11-09 13:53:01 +01:00
parent 554a831af2
commit cde6e39cec
2 changed files with 58 additions and 0 deletions

25
.local/bin/waybar_audio.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# Get default sink name and volume
sink_info=$(pamixer --get-default-sink)
sink_name=$(echo "$sink_info" | awk '{print $3}')
volume=$(pamixer --get-volume)
muted=$(pamixer --get-mute)
# Determine alt value for Waybar
if [ "$muted" = "true" ]; then
case "$sink_name" in
*Steinberg*) alt="headphones-muted" ;;
*) alt="speaker-muted" ;;
esac
else
case "$sink_name" in
*Steinberg*) alt="headphones" ;;
*) alt="speaker" ;;
esac
fi
# Output JSON for Waybar
printf '{"text": "%s%%", "alt": "%s", "class": "%s", "percentage": %s }\n' \
"$volume" "$alt" "$alt" "$volume"