From 1462c868b606e3e998ae625d8c28bad4d4a2ca47 Mon Sep 17 00:00:00 2001 From: Donovan Glover Date: Tue, 28 May 2024 13:01:29 -0400 Subject: [PATCH] hyprland: Use home-manager module for hypridle --- flake.lock | 6 ++--- home/hyprland.nix | 59 ++++++++++++++++++++++++----------------------- 2 files changed, 33 insertions(+), 32 deletions(-) diff --git a/flake.lock b/flake.lock index d10f438f..024f3f48 100644 --- a/flake.lock +++ b/flake.lock @@ -170,11 +170,11 @@ ] }, "locked": { - "lastModified": 1714377222, - "narHash": "sha256-UsDsjWCKlWn8vbXi8Zza9Hkq3xyk8fpvFNo2VM5S74E=", + "lastModified": 1716908526, + "narHash": "sha256-Zl6e/sEVDh07K47XxDGPsXTYT4nI6llUDbQ4xMIwp7k=", "owner": "nix-community", "repo": "home-manager", - "rev": "2af7c78b7bb9cf18406a193eba13ef9f99388f49", + "rev": "373ead20606efa9181cd15ba19a5deac7ead1492", "type": "github" }, "original": { diff --git a/home/hyprland.nix b/home/hyprland.nix index f2ac7b91..9c1b3413 100644 --- a/home/hyprland.nix +++ b/home/hyprland.nix @@ -19,7 +19,6 @@ in home.packages = with pkgs; [ hyprdim hyprnome - hypridle hyprlock hyprshade swww @@ -73,7 +72,6 @@ in "hyprctl dispatch workspace 5000000" "${polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" "hyprdim --no-dim-when-only --persist --ignore-leaving-special --dialog-dim" - "hypridle" "sleep 1 && eww open desktop-icons" "~/.config/${randomBackgroundScript}" ]; @@ -389,33 +387,36 @@ in } ''; - xdg.configFile."hypr/hypridle.conf".text = /* bash */ '' - general { - lock_cmd = pidof hyprlock || hyprlock - before_sleep_cmd = loginctl lock-session - after_sleep_cmd = hyprctl dispatch dpms on - } + services.hypridle = { + enable = true; - listener { - timeout = 150 - on-timeout = brightnessctl -s set 10 - on-resume = brightnessctl -r - } + settings = { + general = { + lock_cmd = "pidof hyprlock || hyprlock"; + before_sleep_cmd = "loginctl lock-session"; + after_sleep_cmd = "hyprctl dispatch dpms on"; + }; - listener { - timeout = 300 - on-timeout = loginctl lock-session - } - - listener { - timeout = 380 - on-timeout = hyprctl dispatch dpms off - on-resume = hyprctl dispatch dpms on - } - - listener { - timeout = 1800 - on-timeout = systemctl suspend - } - ''; + listener = [ + { + timeout = 150; + on-timeout = "brightnessctl -s set 10"; + on-resume = "brightnessctl -r"; + } + { + timeout = 300; + on-timeout = "loginctl lock-session"; + } + { + timeout = 380; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + { + timeout = 1800; + on-timeout = "systemctl suspend"; + } + ]; + }; + }; }