dotfiles/nixos/i3/xidlehook.nix

26 lines
635 B
Nix
Raw Normal View History

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 = {
"PRIMARY_DISPLAY" = "$(xrandr | awk '/ primary/{print $1}')";
};
timers = [
{
delay = 60;
2022-03-10 12:25:23 +00:00
command = ''xrandr --output "$PRIMARY_DISPLAY" --brightness .1'';
canceller = ''xrandr --output "$PRIMARY_DISPLAY" --brightness 1'';
2021-11-04 20:32:40 +00:00
}
{
delay = 600;
2021-11-12 22:36:04 +00:00
command = "${pkgs.writeShellScript "my-script" ''
xrandr --output "$PRIMARY_DISPLAY" --brightness 1
systemctl suspend
''}";
2021-11-04 20:32:40 +00:00
}
];
};
}