diff --git a/.config/Code - OSS/User/settings.json b/.config/Code - OSS/User/settings.json index 6b66bc9..14b2b17 100644 --- a/.config/Code - OSS/User/settings.json +++ b/.config/Code - OSS/User/settings.json @@ -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" diff --git a/.config/sway/config b/.config/sway/config index f64fd3b..a48c6c3 100644 --- a/.config/sway/config +++ b/.config/sway/config @@ -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 diff --git a/.local/bin/toggle-default-audio b/.local/bin/toggle-default-audio new file mode 100755 index 0000000..5e809ed --- /dev/null +++ b/.local/bin/toggle-default-audio @@ -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