Update sb-volume

Now compatible with muteinputs
This commit is contained in:
cronidea 2021-09-28 16:47:38 +01:00 committed by GitHub
parent 505c4a4a13
commit 4192971e8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,15 @@
#!/bin/sh
# Prints the current volume or 🔇 if muted.
if [ "$(pamixer --get-mute)" = "true" ]; then
printf "🔇 $(pamixer --get-volume)%%"
else
printf "🔊 $(pamixer --get-volume)%%"
fi
source="$(pamixer --list-sources | awk '!/Built/{ if (NR==2) {print $1} }')"
if [ "$(pamixer --source $source --get-mute)" = "false" ]; then
printf " 🎙️\n"
fi
case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e pulsemixer ;;
@ -12,17 +21,3 @@ case $BLOCK_BUTTON in
- Scroll to change." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
[ $(pamixer --get-mute) = true ] && echo 🔇 && exit
vol="$(pamixer --get-volume)"
if [ "$vol" -gt "70" ]; then
icon="🔊"
elif [ "$vol" -lt "30" ]; then
icon="🔈"
else
icon="🔉"
fi
echo "$icon$vol%"