38 lines
893 B
Nix
Raw Normal View History

2025-01-04 23:06:06 +01:00
let
# Time in seconds
lockAfter = 1200;
#screenOffAfter = 1500;
2025-01-04 23:06:06 +01:00
suspendAfter = 7200;
in
{
services.hypridle = {
enable = true;
settings = {
general = {
2025-01-04 23:06:06 +01:00
before_sleep_cmd = "loginctl lock-session";
after_sleep_cmd = "hyprctl dispatch dpms on";
lock_cmd = "pidof hyprlock || hyprlock"; # Avoid running multiple instances of hyprlock
};
listener = [
2025-01-04 23:06:06 +01:00
# Lock
{
timeout = lockAfter;
on-timeout = "loginctl lock-session";
}
# Turn off screens TODO still buggy on DP-1
# {
# timeout = screenOffAfter;
# on-timeout = "hyprctl dispatch dpms off";
# on-resume = "hyprctl dispatch dpms on";
# }
2025-01-04 23:06:06 +01:00
# Suspend
{
2025-01-04 23:06:06 +01:00
timeout = suspendAfter;
on-timeout = "systemctl suspend"; # suspend pc
}
];
};
};
}