From cdb4cbd6c0f72d9e6593f544288eb0a2c4e8f182 Mon Sep 17 00:00:00 2001 From: rope Date: Sun, 17 May 2026 12:58:06 +0100 Subject: [PATCH] macbook: add keyboard backlight key bindings and permissions - Add XF86KbdBrightnessUp/Down keybindings (Macbook-only) using swayosd for consistent OSD behaviour with screen brightness and volume - Enable hardware.acpilight for udev rules allowing video group to write to /sys/class/leds/ (keyboard backlight) - Add fred to the video group so brightnessctl/swayosd can write backlight values Co-Authored-By: Claude Sonnet 4.6 --- hosts/FredOS-Macbook.nix | 4 ++++ settings/hyprland.nix | 3 +++ settings/users.nix | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hosts/FredOS-Macbook.nix b/hosts/FredOS-Macbook.nix index 41a607c..75c0332 100644 --- a/hosts/FredOS-Macbook.nix +++ b/hosts/FredOS-Macbook.nix @@ -24,6 +24,10 @@ boot.loader.systemd-boot.configurationLimit = 5; boot.initrd.systemd.enable = true; + # Allow video group (fred) to write to /sys/class/backlight and /sys/class/leds + # (screen brightness and keyboard backlight) + hardware.acpilight.enable = true; + services.logind.settings.Login = { HandleLidSwitch = "suspend"; HandleLidSwitchExternalPower = "suspend"; diff --git a/settings/hyprland.nix b/settings/hyprland.nix index b600a5e..0ad9634 100644 --- a/settings/hyprland.nix +++ b/settings/hyprland.nix @@ -312,6 +312,9 @@ in ", XF86AudioMute, exec, swayosd-client --output-volume mute-toggle" ", XF86MonBrightnessUp, exec, swayosd-client --brightness raise" ", XF86MonBrightnessDown, exec, swayosd-client --brightness lower" + ] ++ lib.optionals isMacbook [ + ", XF86KbdBrightnessUp, exec, swayosd-client --keyboard-brightness raise" + ", XF86KbdBrightnessDown, exec, swayosd-client --keyboard-brightness lower" ]; bindl = [ diff --git a/settings/users.nix b/settings/users.nix index 98aa0e0..d6eb888 100644 --- a/settings/users.nix +++ b/settings/users.nix @@ -11,7 +11,7 @@ users.users.fred = { isNormalUser = true; description = "fred"; - extraGroups = [ "networkmanager" "wheel" "docker" ]; + extraGroups = [ "networkmanager" "wheel" "docker" "video" ]; packages = lib.optionals (lib.elem config.networking.hostName [ "FredOS-Gaming" "FredOS-Macbook" ]) (with pkgs; [ bazaar ]);