38 lines
1018 B
Nix

{inputs, pkgs, ...}:
{
services.hypridle = {
enable = true;
settings = {
general = {
lock_cmd = "pidof hyprlock || hyprlock"; # avoid starting multiple hyprlock instances.
after_sleep_cmd = "hyprctl dispatch dpms on";
ignore_dbus_inhibit = false;
};
listener = [
{
# dim screen after 4 minutes
timeout = 240;
on-timeout = "brightnessctl -s set 10";
# set monitor backlight to minimum, avoid 0 on OLED monitor.
on-resume = "brightnessctl -r";
# monitor backlight restore.
}
{
# lock screen after 5 minutes
timeout = 300;
on-timeout = "loginctl lock-session && hyprctl dispatch dpms off";
on-resume = "hyprctl dispatch dpms on";
}
{
# suspend after 10 minutes
timeout = 600;
on-timeout = "systemctl suspend";
on-resume = "hyprctl dispatch dpms on";
}
];
};
};
}