nix-dotfiles/hm_modules/xidlehook.nix

22 lines
481 B
Nix

{ pkgs, lib, ... }:
with lib;
let
xbacklightCmd = "${pkgs.xorg.xbacklight}/bin/xbacklight";
lightLevel = 10;
in
{
services.xidlehook = {
enable = true;
not-when-audio = true;
not-when-fullscreen = true;
timers = [
{
command = "${xbacklightCmd} -get > /tmp/xbacklight_v && ${xbacklightCmd} -set ${toString lightLevel}";
canceller = "${xbacklightCmd} -set $(cat /tmp/xbacklight_v || echo 100)";
delay = 30;
}
];
};
}