Brightness control
This commit is contained in:
42
modules/system/brightness.nix
Normal file
42
modules/system/brightness.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{ 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-"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user