From 7e988b5315d136bb09a82c4fade2ffbb1574a82e Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 19 Jul 2024 15:53:46 +0200 Subject: [PATCH] Add audio and brightness controll --- defaults/main.yml | 45 +++++++++++++++++++++++++++++++++++++++++++++ templates/config.j2 | 11 +++++++++++ 2 files changed, 56 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index 77256e8..f42340e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -19,6 +19,51 @@ sway__keyboard_lang: 'de' sway__lock: 'swaylock --color 000000 --image /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png' sway__waybar: true +sway__keybindings: + - keybinding: + name: Volume (mute/unmute) + key: $mod+F12 + exec: --no-startup-id pulsemixer --toggle-mute + - keybinding: + name: Volue (default) + key: $mod+Shift+F12 + exec: --no-startup-id pulsemixer --set-volume 42 + - keybinding: + name: volume-up + key: XF86AudioRaiseVolume + exec: --no-startup-id pulsemixer --change-volume +3 + - keybinding: + name: volume-down + key: XF86AudioLowerVolume + exec: --no-startup-id pulsemixer --change-volume -5 + - keybinding: + name: Toggle Mic Mute + key: XF86AudioMicMute + exec: '--no-startup-id pulsemixer --toggle-mute --id $(pulsemixer --list-sources | cut -f3 | grep Default | cut -d "," -f 1 | cut -c 6-)' + - keybinding: + name: Mic volume up + key: $mod+Shift+F4 + exec: '--no-startup-id pulsemixer --change-volume +3 --id $(pulsemixer --list-sources | cut -f3 | grep Default | cut -d "," -f 1 | cut -c 6-)' + - keybinding: + name: Mic volume down + key: $mod+F4 + exec: '--no-startup-id pulsemixer --change-volume -5 --id $(pulsemixer --list-sources | cut -f3 | grep Default | cut -d "," -f 1 | cut -c 6-)' + - keybinding: + name: Toggle Mic Mute + key: XF86AudioMute + exec: --no-startup-id pulsemixer --toggle-mute + - keybinding: + name: darker + key: XF86MonBrightnessDown + exec: --no-startup-id light -U 9 + - keybinding: + name: lighter + key: XF86MonBrightnessUp + exec: --no-startup-id light -A 6 + +sway__keybindings_extra: [] + + # version check for this role? submodules_versioncheck: true diff --git a/templates/config.j2 b/templates/config.j2 index 41a61ae..dd0c0bd 100644 --- a/templates/config.j2 +++ b/templates/config.j2 @@ -225,6 +225,17 @@ mode "resize" { } bindsym $mod+r mode "resize" +# Register default keybindings +{% for keybinding in sway__keybindings %} +bindsym {{ keybinding.key }} exec {{ keybinding.exec }} +{% endfor %} + +# Register additional keybindings +{% for keybinding in sway__keybindings_extra %} +bindsym {{ keybinding.key }} exec {{ keybinding.exec }} +{% endfor %} + + # # Status Bar: #