diff --git a/arch-user/bin/i3blocks/volume.sh b/arch-user/bin/i3blocks/volume.sh old mode 100644 new mode 100755 index 9483b65..5807eca --- a/arch-user/bin/i3blocks/volume.sh +++ b/arch-user/bin/i3blocks/volume.sh @@ -1,3 +1,16 @@ #!/bin/sh -echo "🔈 100% 🎙 MUT" + +sink_mute=$(pactl get-sink-mute @DEFAULT_SINK@) +case "$sink_mute" in + *yes*) sink_res=M;; + *) sink_res=$(pactl get-sink-volume @DEFAULT_SINK@ | sed -e 's/.*\s\([0-9]*%\).*/\1/;t;d');; +esac + +source_mute=$(pactl get-source-mute @DEFAULT_SOURCE@) +case "$source_mute" in + *yes*) source_res=M;; + *) source_res=$(pactl get-source-volume @DEFAULT_SOURCE@ | sed -e 's/.*\s\([0-9]*%\).*/\1/;t;d');; +esac + +echo "🔈 $sink_res 🎙 $source_res" diff --git a/arch-user/config/sway/config.tmpl b/arch-user/config/sway/config.tmpl index 0918b99..dbd09cb 100644 --- a/arch-user/config/sway/config.tmpl +++ b/arch-user/config/sway/config.tmpl @@ -106,12 +106,12 @@ bindsym --to-code $mod+c exec wtype -P XF86Cut bindsym --to-code $mod+d exec wtype -P XF86Copy bindsym --to-code $mod+v exec wtype -P XF86Paste # media -bindsym --to-code XF86MonBrightnessDown exec ~/.local/bin/sway/brightness-set-and-notify.sh 5%- -bindsym --to-code XF86MonBrightnessUp exec ~/.local/bin/sway/brightness-set-and-notify.sh 5%+ -bindsym --to-code XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle -bindsym --to-code XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5% -bindsym --to-code XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5% -bindsym --to-code XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle +bindsym --to-code XF86MonBrightnessDown exec ~/.local/bin/sway/brightness-set-and-notify.sh 5%- && pkill -SIGRTMIN+2 i3blocks +bindsym --to-code XF86MonBrightnessUp exec ~/.local/bin/sway/brightness-set-and-notify.sh 5%+ && pkill -SIGRTMIN+2 i3blocks +bindsym --to-code XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle && pkill -SIGRTMIN+2 i3blocks +bindsym --to-code XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5% && pkill -SIGRTMIN+2 i3blocks +bindsym --to-code XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5% && pkill -SIGRTMIN+2 i3blocks +bindsym --to-code XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle && pkill -SIGRTMIN+2 i3blocks # basic scripts bindsym --to-code $mod+Escape kill bindsym --to-code $mod+Return exec footclient