feat(niri,xbacklight): Brightness control

This commit is contained in:
2025-08-08 20:52:23 -06:00
parent 73c894f7c0
commit 5bc81f909e
5 changed files with 54 additions and 79 deletions

View File

@@ -73,7 +73,7 @@ in {
spawn-at-startup =
[{ command = [ "${pkgs.swaynotificationcenter}/bin/swaync" ]; }
{ command = [ "${pkgs.gammastep}/bin/gammastep" "-o" "-O" "4000k"
{ command = [ (lib.getExe pkgs.gammastep) "-o" "-O" "4000k"
"-b" "0.9:0.9" "-l" "0:0"]; }]
++ lib.optional
(! builtins.isNull cfg.wallpaper)
@@ -175,7 +175,7 @@ in {
{ title = "Discord.*@"; }
];
excludes = [
# ... except when explicitly targeting the window.
# ...except when explicitly targeting the window.
{ is-window-cast-target = true; }
];
block-out-from = "screen-capture";
@@ -226,8 +226,9 @@ in {
binds = {
"Mod+Q".action.close-window = [];
"Mod+Shift+Q".action.quit = [];
"Mod+Ctrl+L".action.spawn = ["${pkgs.swaylock}/bin/swaylock"];
"Mod+D".action.spawn = ["${pkgs.fuzzel}/bin/fuzzel"];
"Mod+Ctrl+L".action.spawn = [ (lib.getExe pkgs.swaylock) ];
"Mod+D".action.spawn = [ (lib.getExe pkgs.fuzzel) ];
"XF86LaunchB".action.spawn = [ (lib.getExe pkgs.fuzzel) ];
"Mod+Shift+Slash".action.show-hotkey-overlay = [];
# Powers off the monitors. They will be powered back on upon any
@@ -279,7 +280,12 @@ in {
"Mod+Shift+J".action.move-window-down = [];
"Mod+Shift+K".action.move-window-up = [];
"Mod+Shift+L".action.move-column-right = [];
"XF86MonBrightnessDown".action.spawn =
["${lib.getExe pkgs.acpilight}" "-dec" "10"];
"XF86MonBrightnessUp".action.spawn =
["${lib.getExe pkgs.acpilight}" "-inc" "10"];
"Mod+1".action.focus-workspace = [1];
"Mod+2".action.focus-workspace = [2];
"Mod+3".action.focus-workspace = [3];

View File

@@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:
let cfg = config.sydnix.xbacklight-permissions;
in {
options.sydnix.xbacklight-permissions = {
enable =
lib.mkEnableOption "the user group that is allowed to use xbacklight";
group = lib.mkOption {
type = lib.types.str;
default = "xbacklight";
};
paths = lib.mkOption {
type = with lib.types; listOf str;
default = [
"/sys/class/backlight/intel_backlight/brightness"
];
};
};
config = lib.mkIf cfg.enable {
users.groups.${cfg.group} = {};
systemd.tmpfiles.settings."50-xbacklight" =
lib.mergeAttrsList
(builtins.map
(path: {
${path}.z = {
inherit (cfg) group;
mode = "0664";
user = "root";
};
})
cfg.paths);
};
}