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
{
config,
lib,
pkgs,
...
}:
{
options.zpha.services.batsignal.enable = lib.mkEnableOption "batsignal";
config = lib.mkIf config.zpha.services.batsignal.enable {
users.users.zaphyra.maid = {
systemd.services.batsignal = {
description = "batsignal - battery monitor daemon";
after = [ "niri-session.target" ];
partOf = [ "niri-session.target" ];
wantedBy = [ "niri-session.target" ];
serviceConfig = {
Restart = "on-failure";
ExecStart =
let
args = [
# expire notifications
"-e"
# show message when battery begins charging/discharging
"-p"
# minimum number of SECONDS to wait between battery checks
"-m10"
# bat levels
"-w20"
"-c10"
"-d5"
"-D"
"systemctl suspend"
];
in
"${lib.getExe pkgs.batsignal} ${lib.escapeShellArgs args}";
};
};
};
};
}