From 8dc0ad1d34b195d9bcf6b2dffcc769c8f75d7d40 Mon Sep 17 00:00:00 2001 From: larstvei Date: Mon, 29 Sep 2025 00:08:08 +0200 Subject: [PATCH] Setup hypridle for automatically dimming, locking and sleeping --- modules/desktop/hyprland/default.nix | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/modules/desktop/hyprland/default.nix b/modules/desktop/hyprland/default.nix index 4990678..134d5cb 100644 --- a/modules/desktop/hyprland/default.nix +++ b/modules/desktop/hyprland/default.nix @@ -3,6 +3,31 @@ programs.kitty.enable = true; programs.hyprlock.enable = true; + services.hypridle = { + enable = true; + settings = { + general = { + lock_cmd = "hyprlock"; + before_sleep_cmd = "loginctl lock-session"; + }; + listener = [ + { + timeout = 150; # 2.5 min + on-timeout = "brightnessctl --save && brightnessctl set 1"; + on-resume = "brightnessctl --restore"; + } + { + timeout = 300; # 5 min + on-resume = "loginctl lock-session"; + } + { + timeout = 900; # 15 min + on-timeout = "systemctl suspend-then-hibernate"; + } + ]; + }; + }; + wayland.windowManager.hyprland = { enable = true;