mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-28 04:20:03 +02:00
i3: toggle mute for all sinks/sources
This commit is contained in:
parent
5a9bf68fad
commit
9db9cab487
2 changed files with 27 additions and 2 deletions
25
bin/toggle-mute
Executable file
25
bin/toggle-mute
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Toggle mute on all sinks or sources.
|
||||
|
||||
case $1 in
|
||||
source|sink)
|
||||
pactl list ${1}s \
|
||||
| awk '/^(Source|Sink) / { source=substr($2,2) }
|
||||
/^\tName: .*.monitor$/ { source=0 }
|
||||
/^\tMute: / { if (source > 0) muted[source] = ($2 == "yes") }
|
||||
END {
|
||||
if (length(muted) == 0) exit;
|
||||
allmuted=1;
|
||||
for (source in muted) {
|
||||
if (!muted[source]) {
|
||||
allmuted=0;
|
||||
}
|
||||
}
|
||||
for (source in muted) {
|
||||
print "pactl set-'$1'-mute "source" "(!allmuted);
|
||||
}
|
||||
}' \
|
||||
| sh
|
||||
;;
|
||||
esac
|
4
config
4
config
|
@ -29,8 +29,8 @@ gaps inner 10
|
|||
# audio
|
||||
bindsym XF86AudioRaiseVolume exec --no-startup-id exec pactl set-sink-volume @DEFAULT_SINK@ +5%
|
||||
bindsym XF86AudioLowerVolume exec --no-startup-id exec pactl set-sink-volume @DEFAULT_SINK@ -5%
|
||||
bindsym XF86AudioMute exec --no-startup-id exec pactl set-sink-mute @DEFAULT_SINK@ toggle
|
||||
bindsym XF86AudioMicMute exec --no-startup-id exec pactl set-source-mute @DEFAULT_SOURCE@ toggle
|
||||
bindsym XF86AudioMute exec --no-startup-id exec ~/.config/i3/bin/toggle-mute sink
|
||||
bindsym XF86AudioMicMute exec --no-startup-id exec ~/.config/i3/bin/toggle-mute source
|
||||
bindsym XF86AudioPlay exec --no-startup-id exec playerctl -p $mediaplayer play-pause
|
||||
bindsym XF86AudioPause exec --no-startup-id exec playerctl -p $mediaplayer pause
|
||||
bindsym XF86AudioStop exec --no-startup-id exec playerctl -p $mediaplayer stop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue