sway: improve shortcuts for muting

This commit is contained in:
Johannes Loher 2022-10-17 09:54:17 +02:00
parent 66f0dbce2e
commit 401b4297b6
3 changed files with 48 additions and 3 deletions

View file

@ -24,7 +24,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "vscode.html-language-features"
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"

View file

@ -223,8 +223,11 @@ bindsym $mod+z exec thunar
# ------------------------------------------------------------------------------
bindsym XF86AudioRaiseVolume exec pactl set-sink-volume $audio_out +5%
bindsym XF86AudioLowerVolume exec pactl set-sink-volume $audio_out -5%
bindsym XF86AudioMute exec pactl set-sink-mute $audio_out toggle
bindsym XF86AudioMicMute exec pactl set-source-mute $audio_in toggle
bindsym XF86AudioMicMute exec $HOME/.local/bin/toggle-default-audio --source
bindsym XF86AudioMute exec $HOME/.local/bin/toggle-default-audio --sink
bindsym $mod+m exec $HOME/.local/bin/toggle-default-audio --source
bindsym $mod+Shift+m exec $HOME/.local/bin/toggle-default-audio --sink
# ------------------------------------------------------------------------------
# Video shortcuts

42
.local/bin/toggle-default-audio Executable file
View file

@ -0,0 +1,42 @@
#!/bin/bash
# Copyright (c) 2022 Johannes Loher
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
print_usage() {
echo "Usage: toggle-default-audio [command]"
echo
echo "Commands:"
echo " -i, --source Toggle the default source."
echo " -o, --sink Toggle the default sink."
echo
}
toggle_default_source() {
pactl set-source-mute $(pactl get-default-source) toggle
}
toggle_default_sink() {
pactl set-sink-mute $(pactl get-default-sink) toggle
}
case $1 in
-i|--source)
toggle_default_source
;;
-o|--sink)
toggle_default_sink
;;
-h|--help)
print_usage
;;
*)
print_usage
exit 1
;;
esac