From 0b09699cc5f2e4f66d04520084b0e153c46010dd Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Mon, 9 Mar 2026 18:52:25 +0100 Subject: [PATCH] hyprland/noctalia: Use hypridle for idle management --- modules/home/desktop/hyprland/classic.nix | 5 ++++- modules/home/desktop/hyprland/noctalia.nix | 12 +++++++++--- modules/home/programs/noctalia-shell.nix | 2 +- modules/home/services/hypridle.nix | 15 ++++++++++++--- 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/modules/home/desktop/hyprland/classic.nix b/modules/home/desktop/hyprland/classic.nix index f81c72b..041da33 100644 --- a/modules/home/desktop/hyprland/classic.nix +++ b/modules/home/desktop/hyprland/classic.nix @@ -18,8 +18,11 @@ services = { wpaperd.enable = true; - hypridle.enable = true; cliphist.enable = true; + hypridle = { + enable = true; + lockCommand = "pidof hyprlock || hyprlock"; + }; }; }; diff --git a/modules/home/desktop/hyprland/noctalia.nix b/modules/home/desktop/hyprland/noctalia.nix index 1d47a09..3253eb4 100644 --- a/modules/home/desktop/hyprland/noctalia.nix +++ b/modules/home/desktop/hyprland/noctalia.nix @@ -14,7 +14,13 @@ noctalia-shell.enable = true; }; - services.cliphist.enable = true; + services = { + cliphist.enable = true; + hypridle = { + enable = true; + lockCommand = "noctalia-shell ipc call lockScreen lock"; + }; + }; }; home.packages = [ pkgs.grimblast ]; @@ -35,8 +41,8 @@ bind = SUPER, V, exec, $ipc launcher clipboard # Manage session - bindrl = SUPER CONTROL, L, exec, $ipc lockScreen lock - bindrl = SUPER CONTROL, S, exec, $ipc sessionMenu lockAndSuspend + bindrl = SUPER CONTROL, L, exec, loginctl lock-session + bindrl = SUPER CONTROL, S, exec, systemctl sleep ''; }; } diff --git a/modules/home/programs/noctalia-shell.nix b/modules/home/programs/noctalia-shell.nix index fff1ec1..b3fd274 100644 --- a/modules/home/programs/noctalia-shell.nix +++ b/modules/home/programs/noctalia-shell.nix @@ -96,7 +96,7 @@ largeButtonsStyle = false; countdownDuration = 3000; }; - idle.enabled = true; + idle.enabled = false; audio.mprisBlacklist = [ "firefox" ]; network.bluetoothAutoConnect = false; location = { diff --git a/modules/home/services/hypridle.nix b/modules/home/services/hypridle.nix index 8a31c11..bb123c3 100644 --- a/modules/home/services/hypridle.nix +++ b/modules/home/services/hypridle.nix @@ -4,17 +4,26 @@ lib, ... }: +let + cfg = config.custom.services.hypridle; +in { - options.custom.services.hypridle.enable = lib.mkEnableOption ""; + options.custom.services.hypridle = { + enable = lib.mkEnableOption ""; + lockCommand = lib.mkOption { + type = lib.types.nonEmptyStr; + default = ""; + }; + }; - config = lib.mkIf config.custom.services.hypridle.enable { + config = lib.mkIf cfg.enable { services.hypridle = { enable = true; package = pkgs-unstable.hypridle; settings = { general = { - lock_cmd = lib.mkIf config.custom.programs.hyprlock.enable "pidof hyprlock || hyprlock"; + lock_cmd = cfg.lockCommand; before_sleep_cmd = "loginctl lock-session"; after_sleep_cmd = "hyprctl dispatch dpms on"; };