diff options
Diffstat (limited to '.config')
-rwxr-xr-x | .config/eww/scripts/volumecontrol | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/.config/eww/scripts/volumecontrol b/.config/eww/scripts/volumecontrol index 7f058c9..2168429 100755 --- a/.config/eww/scripts/volumecontrol +++ b/.config/eww/scripts/volumecontrol @@ -6,14 +6,13 @@ # volumecontrol mute function get_volume { - # amixer get Master | grep '%' | head -n 1 | cut -d '[' -f 2 | cut -d '%' -f 1 - # pactl get-sink-volume @DEFAULT_SINK@ | grep -Po '\d+(?=%)' | head -n 1 - pactl get-sink-volume @DEFAULT_SINK@ | grep '%' | cut -d '%' -f 1 | cut -d ' ' -f 6 + # pactl get-sink-volume @DEFAULT_SINK@ | grep '%' | cut -d '%' -f 1 | cut -d ' ' -f 6 + echo "scale=1; $(mixer vol | grep 'vol.volume=' | cut -d '=' -f 2 | cut -d ':' -f 1)*100" | bc | cut -d '.' -f 1 } function is_mute { - # amixer get Master | grep '%' | grep -oE '[^ ]+$' | grep off > /dev/null - pactl get-sink-mute @DEFAULT_SINK@ | grep 'Mute: yes' >> /dev/null + # pactl get-sink-mute @DEFAULT_SINK@ | grep 'Mute: yes' >> /dev/null + mixer vol | grep 'vol.mute=on' >> /dev/null } function send_notification { @@ -53,27 +52,26 @@ fyi --hint=string:x-canonical-private-synchronous:volumecontrol -u normal "$icon case $1 in up) - # Set the volume on (if it was muted) - # amixer set Master on > /dev/null - pactl set-sink-mute @DEFAULT_SINK@ 0 + # pactl set-sink-mute @DEFAULT_SINK@ 0 + mixer vol.mute=off # Up the volume (+ 2%) - # amixer sset Master 2%+ > /dev/null - pactl set-sink-volume @DEFAULT_SINK@ +2% + # pactl set-sink-volume @DEFAULT_SINK@ +2% + mixer vol.volume=+2% send_notification # canberra-gtk-play -i audio-volume-change ;; down) - # amixer set Master on > /dev/null - pactl set-sink-mute @DEFAULT_SINK@ 0 - # amixer sset Master 2%- > /dev/null - pactl set-sink-volume @DEFAULT_SINK@ -2% + # pactl set-sink-mute @DEFAULT_SINK@ 0 + mixer vol.mute=off + # pactl set-sink-volume @DEFAULT_SINK@ -2% + mixer vol.volume=-2% send_notification # canberra-gtk-play -i audio-volume-change ;; mute) # Toggle mute - # amixer set Master 1+ toggle > /dev/null - pactl set-sink-mute @DEFAULT_SINK@ toggle + # pactl set-sink-mute @DEFAULT_SINK@ toggle + mixer vol.mute=toggle if is_mute ; then icon="" fyi --hint=string:x-canonical-private-synchronous:volumecontrol -u normal "$icon Audio Muted" |