2020-02-08 23:43:37 +00:00
|
|
|
#!/bin/sh
|
2019-11-23 21:23:24 +00:00
|
|
|
|
|
|
|
case $BLOCK_BUTTON in
|
2019-11-24 04:37:40 +00:00
|
|
|
1) setsid "$TERMINAL" -e alsamixer & ;;
|
|
|
|
2) amixer sset Master toggle ;;
|
2019-12-06 20:48:35 +00:00
|
|
|
4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;;
|
|
|
|
5) amixer sset Master 5%- >/dev/null 2>/dev/null ;;
|
2020-04-09 02:01:51 +00:00
|
|
|
3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
|
2019-11-23 21:23:24 +00:00
|
|
|
- Middle click to mute.
|
|
|
|
- Scroll to change."
|
|
|
|
esac
|
|
|
|
|
2019-11-24 04:37:40 +00:00
|
|
|
volstat="$(amixer get Master)"
|
2019-11-23 21:23:24 +00:00
|
|
|
|
2019-11-24 04:37:40 +00:00
|
|
|
echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit
|
|
|
|
|
2020-03-23 16:21:25 +00:00
|
|
|
vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q")
|
2019-11-23 21:23:24 +00:00
|
|
|
|
|
|
|
if [ "$vol" -gt "70" ]; then
|
|
|
|
icon="🔊"
|
|
|
|
elif [ "$vol" -lt "30" ]; then
|
|
|
|
icon="🔈"
|
|
|
|
else
|
|
|
|
icon="🔉"
|
|
|
|
fi
|
|
|
|
|
|
|
|
printf "%s %s%%\\n" "$icon" "$vol"
|