From 1d5ea18ba2e2d98394c992e747df20a75682ec42 Mon Sep 17 00:00:00 2001 From: sommerfeld Date: Wed, 13 May 2026 13:43:19 +0100 Subject: feat(sway): bind brightness and ThinkPad XF86 multimedia keys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Install brightnessctl and bind all seven ThinkPad multimedia keys: - XF86MonBrightnessUp/Down → brightnessctl ±5% - XF86AudioMicMute → pactl source mute - XF86Bluetooth → bt-toggle.sh (bluetoothctl + notify-send) - XF86ScreenSaver (Fn+F2) → same as $mod+Shift+s (pause + swaylock) - XF86Sleep → systemctl suspend - XF86WLAN / XF86RFKill → rfkill toggle Note: rfkill may need a passwordless doas rule (permit nopass :wheel cmd rfkill) or group membership to write /dev/rfkill without privileges; not wired speculatively. --- dot_config/sway/config | 12 ++++++++++++ dot_config/sway/executable_bt-toggle.sh | 16 ++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 dot_config/sway/executable_bt-toggle.sh (limited to 'dot_config/sway') diff --git a/dot_config/sway/config b/dot_config/sway/config index f88875b..7f95a62 100644 --- a/dot_config/sway/config +++ b/dot_config/sway/config @@ -135,6 +135,18 @@ bindsym XF86AudioPlay exec playerctl play-pause bindsym XF86AudioNext exec playerctl next bindsym XF86AudioPrev exec playerctl previous +# Brightness +bindsym XF86MonBrightnessUp exec brightnessctl set +5% +bindsym XF86MonBrightnessDown exec brightnessctl set 5%- + +# ThinkPad multimedia keys +bindsym XF86AudioMicMute exec pactl set-source-mute @DEFAULT_SOURCE@ toggle +bindsym XF86Bluetooth exec ~/.config/sway/bt-toggle.sh +bindsym XF86ScreenSaver exec "playerctl -a pause; swaylock -f -e -c 282828" +bindsym XF86Sleep exec systemctl suspend +bindsym XF86WLAN exec rfkill toggle wifi +bindsym XF86RFKill exec rfkill toggle all + # Screenshots bindsym Print exec sh -c 'grim -g "$(slurp)" - | tee ~/pics/screenshots/$(date +%Y-%m-%d-%H-%M-%S).png | wl-copy' bindsym Shift+Print exec sh -c 'grim - | tee ~/pics/screenshots/$(date +%Y-%m-%d-%H-%M-%S).png | wl-copy' diff --git a/dot_config/sway/executable_bt-toggle.sh b/dot_config/sway/executable_bt-toggle.sh new file mode 100644 index 0000000..95958f9 --- /dev/null +++ b/dot_config/sway/executable_bt-toggle.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Toggle Bluetooth power via bluetoothctl. Uses notify-send's synchronous +# hint so repeated toggles replace the previous notification instead of +# stacking. +set -eu + +state=$(bluetoothctl show | awk '/Powered:/ {print $2}') +if [ "$state" = "yes" ]; then + bluetoothctl power off >/dev/null + notify-send -t 1500 -h string:x-canonical-private-synchronous:bt \ + 'Bluetooth' 'off' +else + bluetoothctl power on >/dev/null + notify-send -t 1500 -h string:x-canonical-private-synchronous:bt \ + 'Bluetooth' 'on' +fi -- cgit v1.3.1