dotfiles/nixos/i3/xidlehook.nix

29 lines
766 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" = "$(${pkgs.xorg.xrandr} | awk '/ primary/{print $1}')";
2021-11-04 20:32:40 +00:00
};
timers = [
{
delay = 60;
command =
''${pkgs.xorg.xrandr} --output "$PRIMARY_DISPLAY" --brightness .1'';
canceller =
''${pkgs.xorg.xrandr} --output "$PRIMARY_DISPLAY" --brightness 1'';
2021-11-04 20:32:40 +00:00
}
{
delay = 240;
2021-11-12 22:36:04 +00:00
command = "${pkgs.writeShellScript "my-script" ''
${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
}
];
};
}