2021-11-28 14:09:00 +00:00

36 lines
784 B
Bash
Executable File

#!/bin/sh
# Prints the current volume or 🔇 if muted.
case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e pulsemixer ;;
2) pamixer -t ;;
4) pamixer --allow-boost -i 1 ;;
5) pamixer --allow-boost -d 1 ;;
3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
- Middle click to mute.
- Scroll to change." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
vol="$(pamixer --get-volume)"
if [ "$vol" -gt "70" ]; then
icon="🔊"
elif [ "$vol" -gt "30" ]; then
icon="🔉"
elif [ "$vol" -gt "0" ]; then
icon="🔈"
else
echo 🔇 && exit
fi
source="$(pamixer --list-sources | awk '!/Built/{ if (NR==2) {print $1} }')"
if [ "$(pamixer --source $source --get-mute)" = "true" ]; then
mute="❌🎙️"
else
mute="✔️🎙️"
fi
echo "$icon$vol% $mute"