{inputs, pkgs, ...}: { services.hypridle = { enable = true; settings = { general = { # avoid starting multiple hyprlock instances. before_sleep_cmd = "pidof hyprlock || hyprlock --immediate-render --no-fade-in"; lock_cmd = "pidof hyprlock || hyprlock --immediate-render --no-fade-in"; after_sleep_cmd = "hyprctl dispatch dpms on"; ignore_dbus_inhibit = false; }; listener = [ { # turn off keyboard backlight after 20 seconds timeout = 10; on-timeout = "brightnessctl -d platform::kbd_backlight -s set 0"; # restore keyboard backlight on resume to previous level. on-resume = "brightnessctl -d platform::kbd_backlight -r"; } { # dim screen after 2 minutes timeout = 120; on-timeout = "brightnessctl -s set 2"; on-resume = "brightnessctl -r"; # monitor backlight restore. } { # lock screen after 10 minutes timeout = 600; on-timeout = "loginctl lock-session && hyprctl dispatch dpms off"; on-resume = "hyprctl dispatch dpms on"; } { # suspend after 15 minutes timeout = 900; on-timeout = "systemctl suspend"; on-resume = "hyprctl dispatch dpms on"; } ]; }; }; }