added audio scripts used in my river configuration
This commit is contained in:
25
.local/bin/waybar_audio.sh
Executable file
25
.local/bin/waybar_audio.sh
Executable 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"
|
||||
|
||||
Reference in New Issue
Block a user