From 789de86840e227ea3c89a33d23bac72e6b123b84 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Fri, 13 Dec 2024 18:31:03 -0800 Subject: [PATCH] feat: correctly configure hypridle --- users/youwen/linux/hyprland/common.nix | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/users/youwen/linux/hyprland/common.nix b/users/youwen/linux/hyprland/common.nix index 628aba9..af22c56 100644 --- a/users/youwen/linux/hyprland/common.nix +++ b/users/youwen/linux/hyprland/common.nix @@ -378,9 +378,26 @@ services.hypridle = { enable = true; settings = { - lock_cmd = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock"; # avoid starting multiple hyprlock instances. - before_sleep_cmd = "loginctl lock-session"; # lock before suspend. - after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display. + general = { + lock_cmd = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock"; # avoid starting multiple hyprlock instances. + before_sleep_cmd = "loginctl lock-session"; # lock before suspend. + after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display. + }; + listener = [ + { + timeout = 1500; + on-timeout = "loginctl lock-session"; + } + { + timeout = 330; # 5.5min + on-timeout = "hyprctl dispatch dpms off"; # screen off when timeout has passed + on-resume = "hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired. + } + { + timeout = 1800; + on-timeout = "systemctl suspend"; + } + ]; }; }; }