From 2e72b14d49eded4f442ec7e6e274f93a0ca73343 Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Sun, 20 Oct 2024 10:46:40 +0700 Subject: [PATCH] hypridle: use home manager module for hypridle --- home/modules/hyprland/hypridle.nix | 50 +++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/home/modules/hyprland/hypridle.nix b/home/modules/hyprland/hypridle.nix index dd65e53..5c7635a 100644 --- a/home/modules/hyprland/hypridle.nix +++ b/home/modules/hyprland/hypridle.nix @@ -4,30 +4,30 @@ let in { config = lib.mkIf cfg.enable { - home.packages = [ unstable.hypridle ]; - - home.file.".config/hypr/hypridle.conf".text = /*hyprlang*/ '' - general { - lock_cmd = "pidof hyprlock || hyprlock" - before_sleep_cmd = "hyprlock" - after_sleep_cmd = hyprctl dispatch dpms on - } - - listener { - timeout = ${toString cfg.hypridle.lockTimeout} - on-timeout = "hyprlock" - } - - listener { - timeout = ${toString cfg.hypridle.dpmsTimeout} - on-timeout = hyprctl dispatch dpms off - on-resume = hyprctl dispatch dpms on - } - - listener { - timeout = ${toString cfg.hypridle.suspendTimeout} - on-timeout = systemctl suspend - } - ''; + services.hypridle = { + enable = true; + settings = { + general = { + lock_cmd = "pidof hyprlock || hyprlock"; + before_sleep_cmd = "loginctl lock-session"; + after_sleep_cmd = "hyprctl dispatch dpms on"; + }; + listener = [ + { + timeout = cfg.hypridle.lockTimeout; + on-timeout = "loginctl lock-session"; + } + { + timeout = cfg.hypridle.dpmsTimeout; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + { + timeout = cfg.hypridle.suspendTimeout; + on-timeout = "systemctl suspend"; + } + ]; + }; + }; }; }