diff options
| author | 2026-05-13 13:43:19 +0100 | |
|---|---|---|
| committer | 2026-05-13 13:43:19 +0100 | |
| commit | 1d5ea18ba2e2d98394c992e747df20a75682ec42 (patch) | |
| tree | ec5930b20c91c78a2ae0dc3c67b5efd1814b6087 /dot_config/sway/executable_bt-toggle.sh | |
| parent | abf9846c1b40ed0cc915e47c3daca94022c74d29 (diff) | |
| download | dotfiles-1d5ea18ba2e2d98394c992e747df20a75682ec42.tar.gz dotfiles-1d5ea18ba2e2d98394c992e747df20a75682ec42.tar.bz2 dotfiles-1d5ea18ba2e2d98394c992e747df20a75682ec42.zip | |
feat(sway): bind brightness and ThinkPad XF86 multimedia keys
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.
Diffstat (limited to 'dot_config/sway/executable_bt-toggle.sh')
| -rw-r--r-- | dot_config/sway/executable_bt-toggle.sh | 16 |
1 files changed, 16 insertions, 0 deletions
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 |
