scripts/i3-configuration/i3blocks/volume.sh

20 lines
452 B
Bash
Raw Normal View History

2024-11-15 11:59:05 +01:00
#!/bin/bash
# Get the current volume level and mute status
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | tr -d '%')
mute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')
2025-11-01 15:36:22 +01:00
color="#50FA7B"
2024-11-15 11:59:05 +01:00
# Determine icon and color based on mute status
if [ "$mute" = "yes" ]; then
2025-11-01 15:36:22 +01:00
icon="🔇" # Muted
color="#FF5555"
2024-11-15 11:59:05 +01:00
else
2025-11-01 15:36:22 +01:00
icon="🔊" # Volume icon
2024-11-15 11:59:05 +01:00
fi
# Output the volume with icon and color
echo "$icon $volume%"
echo
2025-11-01 15:36:22 +01:00
echo "$color"