From eee2f9ee456efdd3a9066065367a20e467c3327b Mon Sep 17 00:00:00 2001 From: Nydragon Date: Sat, 21 Sep 2024 20:36:52 +0200 Subject: [PATCH] fix(hypridle): enable hyprland specific stuff conditionally --- home/hypridle/default.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/home/hypridle/default.nix b/home/hypridle/default.nix index d026e7f..ef0606e 100644 --- a/home/hypridle/default.nix +++ b/home/hypridle/default.nix @@ -4,14 +4,19 @@ osConfig, ... }: -lib.mkIf (osConfig.programs.hyprland.enable || osConfig.programs.sway.enable) { +let + hyprEnabled = osConfig.programs.hyprland.enable; + swayEnabled = osConfig.programs.sway.enable; + inherit (lib) mkIf; +in +mkIf (hyprEnabled || swayEnabled) { services.hypridle = { enable = true; settings = { general = { lock_cmd = "pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock"; before_sleep_cmd = "loginctl lock-session"; - after_sleep_cmd = "hyprctl dispatch dpms on"; + after_sleep_cmd = mkIf hyprEnabled "hyprctl dispatch dpms on"; }; listener = [ @@ -19,11 +24,11 @@ lib.mkIf (osConfig.programs.hyprland.enable || osConfig.programs.sway.enable) { timeout = 300; # 5min on-timeout = "loginctl lock-session"; # lock screen when timeout has passed } - { + (mkIf hyprEnabled { 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; # 30min on-timeout = "systemctl suspend"; # suspend pc