Files
samfelag/modules/system/brightness.nix
2024-12-04 14:33:49 +01:00

43 lines
1.4 KiB
Nix

{ config, lib, pkgs, inputs, ... }:
with lib;
let
cfg = config.samfelag.modules.system.brightness;
hyprCfg = config.samfelag.modules.desktop.wm.hyprland;
in
{
options.samfelag.modules.system.brightness = {
enable = mkEnableOption "Brightness support";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
brightnessctl
];
# - Hyprland keybindings ---------------------
hm.wayland.windowManager.hyprland.settings = lib.mkIf hyprCfg.enable {
bind = [
# Brightness control
", XF86MonBrightnessUp, exec, brightnessctl set +5%"
", XF86MonBrightnessDown, exec, brightnessctl set -5%"
# Keyboard brightness control
"${hyprCfg.mod}, XF86MonBrightnessUp, exec, brightnessctl -d platform::kbd_backlight set +1"
"${hyprCfg.mod}, XF86MonBrightnessDown, exec, brightnessctl -d platform::kbd_backlight set -1"
];
binde = [
# Brightness control (keep button pressed)
", XF86MonBrightnessUp, exec, brightnessctl set +5%"
", XF86MonBrightnessDown, exec, brightnessctl set 5%-"
# Keyboard brightness control (keep button pressed)
"${hyprCfg.mod}, XF86MonBrightnessUp, exec, brightnessctl -d platform::kbd_backlight set +1"
"${hyprCfg.mod}, XF86MonBrightnessDown, exec, brightnessctl -d platform::kbd_backlight set 1-"
];
};
};
}