This commit is contained in:
Lucy von Overheidt 2025-09-09 18:03:42 +02:00
commit 0df1237eb2
19 changed files with 1921 additions and 0 deletions

44
modules/hypridle.nix Normal file
View file

@ -0,0 +1,44 @@
{
pkgs,
lib,
config,
...
}:
let
lock = "${pkgs.systemd}/bin/loginctl lock-session";
brillo = lib.getExe pkgs.brillo;
# timeout after which DPMS kicks in
timeout = 300;
in
{
# screen idle
services.hypridle = {
enable = true;
settings = {
general.lock_cmd = lib.getExe config.programs.hyprlock.package;
listener = [
{
timeout = timeout - 10;
# save the current brightness and dim the screen over a period of
# 500 ms
on-timeout = "${brillo} -O; ${brillo} -u 500000 -S 10";
# brighten the screen over a period of 250ms to the saved value
on-resume = "${brillo} -I -u 250000";
}
{
inherit timeout;
}
{
timeout = timeout + 10;
on-timeout = lock;
}
];
};
};
systemd.user.services.hypridle.Unit.After = lib.mkForce "graphical-session.target";
}