2022-03-10 12:25:23 +00:00
|
|
|
{ config, pkgs, ... }: {
|
2021-11-04 20:32:40 +00:00
|
|
|
services.xidlehook = {
|
|
|
|
enable = true;
|
|
|
|
not-when-audio = true;
|
|
|
|
not-when-fullscreen = true;
|
|
|
|
environment = {
|
2022-03-20 21:05:06 +00:00
|
|
|
"PRIMARY_DISPLAY" =
|
|
|
|
"$(${pkgs.xorg.xrandr}/bin/xrandr | awk '/ primary/{print $1}')";
|
2021-11-04 20:32:40 +00:00
|
|
|
};
|
|
|
|
timers = [
|
|
|
|
{
|
|
|
|
delay = 60;
|
2022-03-20 21:05:06 +00:00
|
|
|
command = ''
|
|
|
|
${pkgs.xorg.xrandr}/bin/xrandr --output "$PRIMARY_DISPLAY" --brightness .1'';
|
|
|
|
canceller = ''
|
|
|
|
${pkgs.xorg.xrandr}/bin/xrandr --output "$PRIMARY_DISPLAY" --brightness 1'';
|
2021-11-04 20:32:40 +00:00
|
|
|
}
|
|
|
|
{
|
2022-03-20 20:58:39 +00:00
|
|
|
delay = 240;
|
2022-03-20 21:05:06 +00:00
|
|
|
command = "${pkgs.writeShellScript "enable-display-and-suspend" ''
|
2022-03-20 20:58:39 +00:00
|
|
|
${pkgs.xorg.xrandr}/bin/xrandr --output "$PRIMARY_DISPLAY" --brightness 1
|
|
|
|
${pkgs.xorg.xrandr}/bin/xrandr --auto
|
2021-11-12 22:36:04 +00:00
|
|
|
systemctl suspend
|
|
|
|
''}";
|
2021-11-04 20:32:40 +00:00
|
|
|
}
|
|
|
|
];
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|