implemented global mue button

This commit is contained in:
Niklas 2021-01-17 17:33:10 +01:00
parent 38c5ad8273
commit 926ac47383
4 changed files with 29 additions and 1 deletions

View File

@ -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 XF86AudioPrev exec --no-startup-id "playerctl --player=spotify,%any previous"
bindsym XF86AudioPlay exec --no-startup-id "playerctl --player=spotify,%any play-pause" 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 bindsym $mod+Shift+w exec --no-startup-id networkmanager_dmenu
### autostart ### ### autostart ###

View File

@ -44,7 +44,7 @@ font-1 = "Hack Nerd Font:style=Regular:pixelsize=10;2"
modules-left = i3 modules-left = i3
modules-center = 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-position = right
tray-padding = 2 tray-padding = 2
@ -218,6 +218,12 @@ click-left = $HOME/.config/polybar/wireguard-switch.sh
hook-0 = $HOME/.config/polybar/wireguard-info.sh hook-0 = $HOME/.config/polybar/wireguard-info.sh
initial = 1 initial = 1
[module/mute-mic]
type = custom/ipc
hook-0 = $XDG_CONFIG_HOME/polybar/is-muted.sh
inital = 1
[settings] [settings]
screenchange-reload = true screenchange-reload = true
;compositing-background = xor ;compositing-background = xor

8
.config/polybar/is-muted.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env sh
if amixer get Capture | grep '\[off\]' > /dev/null
then
echo ""
else
echo ""
fi

View File

@ -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