diff --git a/.config/i3/config b/.config/i3/config index a83da38..cb7e24e 100755 --- a/.config/i3/config +++ b/.config/i3/config @@ -178,6 +178,8 @@ bindsym XF86AudioNext exec --no-startup-id "playerctl --player=spotify,%any ne bindsym XF86AudioPrev exec --no-startup-id "playerctl --player=spotify,%any previous" bindsym XF86AudioPlay exec --no-startup-id "playerctl --player=spotify,%any play-pause" +bindsym $mod+m exec --no-startup-id $XDG_DATA_HOME/scripts/toggle-mute.sh && polybar-msg hook mute-mic 1 + bindsym $mod+Shift+w exec --no-startup-id networkmanager_dmenu ### autostart ### diff --git a/.config/polybar/config b/.config/polybar/config index b3a12f3..99ba094 100755 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -44,7 +44,7 @@ font-1 = "Hack Nerd Font:style=Regular:pixelsize=10;2" modules-left = i3 modules-center = -modules-right = playerctl pulseaudio wlan wireguard-status battery date +modules-right = playerctl pulseaudio wlan mute-mic wireguard-status battery date tray-position = right tray-padding = 2 @@ -218,6 +218,12 @@ click-left = $HOME/.config/polybar/wireguard-switch.sh hook-0 = $HOME/.config/polybar/wireguard-info.sh initial = 1 +[module/mute-mic] +type = custom/ipc + +hook-0 = $XDG_CONFIG_HOME/polybar/is-muted.sh +inital = 1 + [settings] screenchange-reload = true ;compositing-background = xor diff --git a/.config/polybar/is-muted.sh b/.config/polybar/is-muted.sh new file mode 100755 index 0000000..f2b9007 --- /dev/null +++ b/.config/polybar/is-muted.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +if amixer get Capture | grep '\[off\]' > /dev/null +then + echo "" +else + echo "" +fi diff --git a/.local/share/scripts/toggle-mute.sh b/.local/share/scripts/toggle-mute.sh new file mode 100755 index 0000000..303f901 --- /dev/null +++ b/.local/share/scripts/toggle-mute.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env sh + +# index=$(pacmd list-sources | grep -oP '\* index: \d+' | awk '{ print $3 }') + +# TODO default source not hardcoded +# pactl set-source-mute $index toggle + + +# Use the alsa approach + +amixer -q -D pulse set Capture toggle +