This repository has been archived by the owner on Aug 5, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
brightness.nix
58 lines (52 loc) · 1.43 KB
/
brightness.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{
config,
pkgs,
lib,
...
}: let
inherit (lib.options) mkOption;
inherit (lib.types) ints bool enum package;
cfg = config.modules.usrEnv.brightness;
in {
options.modules.usrEnv.brightness = {
enable = mkOption {
type = bool;
default = false;
description = ''
Enable brightness management with systemd.
'';
};
package = mkOption {
type = package;
default = pkgs.writeShellApplication {
name = "set-system-brightness";
runtimeInputs = with pkgs; [brightnessctl];
text = "brightnessctl set ${cfg.value}";
};
};
value = mkOption {
type = ints.between 0 100;
default = 85; # try to save some battery on laptops
description = ''
The screen brightness that will be set once the graphical target is reached.
'';
};
service = {
type = mkOption {
type = enum ["oneshot" "simple"];
default = "oneshot";
description = ''
The type of the service to be used for setting brightness on graphical session start.
'';
};
target = mkOption {
type = enum ["graphical-session.target" "multi-user.target"];
default = "graphical-session.target";
description = ''
The target that the systemd-brightnessd service will be bound to.
This effectively sets the `after` attribute in the serviceConfig
'';
};
};
};
}