Bind XF86MonBrightnessUp/Down to brightnessctl in the repeat-while-held block, mirroring the volume keys. A new brightness module installs brightnessctl's udev rule and adds the user to the video group so the backlight can be dimmed without root.
24 lines
607 B
Nix
24 lines
607 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
# Screen backlight control via brightnessctl.
|
|
let
|
|
cfg = config.modules.desktop.brightness;
|
|
user = config.user.name;
|
|
in
|
|
{
|
|
options.modules.desktop.brightness.enable = lib.mkEnableOption "brightnessctl backlight control";
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
environment.systemPackages = [ pkgs.brightnessctl ];
|
|
|
|
# The udev rule chgrps each backlight's brightness node to `video` and adds
|
|
# group write, so a member can dim the panel without root.
|
|
services.udev.packages = [ pkgs.brightnessctl ];
|
|
users.users.${user}.extraGroups = [ "video" ];
|
|
};
|
|
}
|