volume script uses pulse by default
This commit is contained in:
parent
475698e57d
commit
68acbc2bff
1 changed files with 17 additions and 7 deletions
|
@ -1,20 +1,30 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Prints the current volume or 🔇 if muted. Uses PulseAudio by default,
|
||||||
|
# uncomment the ALSA lines if you remove PulseAudio.
|
||||||
|
|
||||||
case $BLOCK_BUTTON in
|
case $BLOCK_BUTTON in
|
||||||
1) setsid "$TERMINAL" -e alsamixer & ;;
|
# 1) setsid "$TERMINAL" -e alsamixer & ;;
|
||||||
2) amixer sset Master toggle ;;
|
# 2) amixer sset Master toggle ;;
|
||||||
4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;;
|
# 4) amixer sset Master 5%+ >/dev/null 2>/dev/null ;;
|
||||||
5) amixer sset Master 5%- >/dev/null 2>/dev/null ;;
|
# 5) amixer sset Master 5%- >/dev/null 2>/dev/null ;;
|
||||||
|
1) setsid "$TERMINAL" -e pulsemixer & ;;
|
||||||
|
2) pulsemixer --toggle-mute ;;
|
||||||
|
4) pulsemixer --change-volume +5 ;;
|
||||||
|
5) pulsemixer --change-volume -5 ;;
|
||||||
3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
|
3) notify-send "📢 Volume module" "\- Shows volume 🔊, 🔇 if muted.
|
||||||
- Middle click to mute.
|
- Middle click to mute.
|
||||||
- Scroll to change."
|
- Scroll to change."
|
||||||
esac
|
esac
|
||||||
|
|
||||||
volstat="$(amixer get Master)"
|
volstat="$(pactl list sinks)"
|
||||||
|
# volstat="$(amixer get Master)" # ALSA only equivalent.
|
||||||
|
|
||||||
echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit
|
echo "$volstat" | grep -q "Mute: yes" && printf "🔇\\n" && exit
|
||||||
|
# echo "$volstat" | grep "\[off\]" >/dev/null && printf "🔇\\n" && exit # ALSA
|
||||||
|
|
||||||
vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q")
|
vol="$(echo "$volstat" | grep '^[[:space:]]Volume:' | sed "s,.* \([0-9]\+\)%.*,\1,;1q")"
|
||||||
|
# vol=$(echo "$volstat" | grep -o "\[[0-9]\+%\]" | sed "s/[^0-9]*//g;1q") # ALSA
|
||||||
|
|
||||||
if [ "$vol" -gt "70" ]; then
|
if [ "$vol" -gt "70" ]; then
|
||||||
icon="🔊"
|
icon="🔊"
|
||||||
|
|
Loading…
Reference in a new issue