myconfigfiles/.config/sway/audio.sh

28 lines
516 B
Bash
Executable file

#!/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
if [ "$volume" -gt "84" ]; then
echo "🔊 $volume%"
elif [ "$volume" -gt "44" ]; then
echo "🔉 $volume%"
elif [ "$volume" -gt "0" ]; then
echo "🔈 $volume%"
else
echo "🔇"
fi