myconfigfiles/.config/sway/audio.sh

29 lines
516 B
Bash
Raw Normal View History

2024-11-09 16:25:08 +01:00
#!/bin/bash
current_volume=$(/usr/bin/wpctl get-volume @DEFAULT_AUDIO_SINK@)
volume="$(echo $current_volume | cut -f 2 -d " " | sed 's/\.//g')"
if [[ $current_volume == *"MUTED"* ]]; then
echo "🔇"
fi
if [ "$volume" -lt "100" ]; then
volume="${volume:1}"
fi
if [ "$volume" -lt "10" ]; then
volume="${volume:1}"
fi
2025-01-14 18:04:31 +01:00
if [ "$volume" -gt "84" ]; then
echo "🔊 $volume%"
elif [ "$volume" -gt "44" ]; then
echo "🔉 $volume%"
elif [ "$volume" -gt "0" ]; then
echo "🔈 $volume%"
2024-11-09 16:25:08 +01:00
else
2025-01-14 18:04:31 +01:00
echo "🔇"
2024-11-09 16:25:08 +01:00
fi