diff --git a/etc/sway/modes/default.conf b/etc/sway/modes/default.conf index a00b386..73f6436 100644 --- a/etc/sway/modes/default.conf +++ b/etc/sway/modes/default.conf @@ -32,6 +32,7 @@ $bindsym $mod+Shift+e exec nwg-bar -x $bindsym --locked XF86AudioRaiseVolume exec $volume_up $bindsym --locked XF86AudioLowerVolume exec $volume_down $bindsym --locked XF86AudioMute exec $volume_mute +$bindsym --locked XF86AudioMicMute exec $mic_mute $bindsym --locked XF86AudioPlay exec playerctl play-pause $bindsym --locked XF86AudioNext exec playerctl next $bindsym --locked XF86AudioPrev exec playerctl previous diff --git a/etc/sway/variables b/etc/sway/variables index 3d1d2e0..ae01908 100644 --- a/etc/sway/variables +++ b/etc/sway/variables @@ -44,6 +44,7 @@ set $brightness_down light -r -U $($brightness_step) && $brightness_bar set $volume_down pulsemixer --change-volume -5 && $volume_bar set $volume_up pulsemixer --change-volume +5 && $volume_bar set $volume_mute pulsemixer --toggle-mute && $volume_bar +set $mic_mute /usr/share/sway/scripts/mic-mute.sh # Clipboard history set $clipboard cliphist list | rofi -dmenu -font "$gui-font" -p "Select item to copy:" -lines 10 -width 35 | cliphist decode | wl-copy diff --git a/usr/share/sway/scripts/mic-mute.sh b/usr/share/sway/scripts/mic-mute.sh new file mode 100755 index 0000000..338e945 --- /dev/null +++ b/usr/share/sway/scripts/mic-mute.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +MIC="${1:-'Capture'}" + +amixer sset "$MIC" toggle + +STATE="$(amixer sget "$MIC",0 | sed -E -e '0,/^.*\[(on|off)\].*$/d' -e 's/^.*\[(\w+)\].*$/\1/')" + +test -n "$STATE" && notify-send \ + --app-name sway \ + --expire-time 800 \ + "Microphone is $STATE"