From 34bf1c7c227977310420bfa848f2e75e2108e335 Mon Sep 17 00:00:00 2001 From: alexion Date: Sun, 23 Aug 2026 12:31:51 -0400 Subject: [PATCH] feat(hyprlock): add idle lock inhibit toggle --- modules/desktop/hyprland/hyprlock.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/modules/desktop/hyprland/hyprlock.nix b/modules/desktop/hyprland/hyprlock.nix index 45fd047..a7d8df0 100644 --- a/modules/desktop/hyprland/hyprlock.nix +++ b/modules/desktop/hyprland/hyprlock.nix @@ -11,6 +11,26 @@ let # The hyprlock this module installs, used by the lock keybind below. hyprlock = "${config.home-manager.users.${user}.programs.hyprlock.package}/bin/hyprlock"; + + idleLockToggle = pkgs.writeShellScript "lockscreen-idle-inhibit-toggle" '' + unit=lockscreen-idle-inhibit.service + + if ${pkgs.systemd}/bin/systemctl --user is-active --quiet "$unit"; then + ${pkgs.systemd}/bin/systemctl --user stop "$unit" + exit 0 + fi + + ${pkgs.systemd}/bin/systemd-run \ + --user \ + --collect \ + --unit=lockscreen-idle-inhibit \ + --description="Disable idle-triggered screen locking" \ + ${pkgs.systemd}/bin/systemd-inhibit \ + --what=idle \ + --who=lockscreen-hotkey \ + --why="lock screen disabled by hotkey" \ + ${pkgs.coreutils}/bin/sleep infinity + ''; in { options.modules.desktop.hyprland.hyprlock.enable = lib.mkEnableOption "the hyprlock lock screen"; @@ -55,6 +75,7 @@ in # hyprlock never stacks over the first. wayland.windowManager.hyprland.settings.bind = [ "$mod, X, exec, ${pkgs.procps}/bin/pidof hyprlock || ${hyprlock}" + "$mod CTRL, X, exec, ${idleLockToggle}" ]; }; }; -- 2.47.3