From 48248e8c7d30a8f76976f3a05535c3dc8cf7b5f5 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Thu, 22 Oct 2026 19:31:16 +0200 Subject: [PATCH] pinwheel: Lock instead of suspend on lid close Have logind ignore the lid switch and suspend/hibernate keys so the machine stays reachable over SSH with the lid closed. SUPER + SHIFT + x remains the way to suspend; closing the lid now only locks the screen. --- hosts/pinwheel/modules/hyprlock/default.nix | 7 +++++++ hosts/pinwheel/modules/power/default.nix | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/hosts/pinwheel/modules/hyprlock/default.nix b/hosts/pinwheel/modules/hyprlock/default.nix index 45fc591..76ff1c1 100644 --- a/hosts/pinwheel/modules/hyprlock/default.nix +++ b/hosts/pinwheel/modules/hyprlock/default.nix @@ -82,6 +82,13 @@ in (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pause-music}; ${dpms-lock}")'') ]; } + { + _args = [ + "switch:on:Lid Switch" + (lib.generators.mkLuaInline ''hl.dsp.exec_cmd("${pkgs.procps}/bin/pidof hyprlock || { ${pause-music}; ${dpms-lock}; }")'') + { locked = true; } + ]; + } { _args = [ "SUPER + SHIFT + x" diff --git a/hosts/pinwheel/modules/power/default.nix b/hosts/pinwheel/modules/power/default.nix index ae5defa..c61b28a 100644 --- a/hosts/pinwheel/modules/power/default.nix +++ b/hosts/pinwheel/modules/power/default.nix @@ -40,6 +40,14 @@ in enable = true; }; + logind.settings.Login = { + HandleLidSwitch = "ignore"; + HandleLidSwitchExternalPower = "ignore"; + HandleLidSwitchDocked = "ignore"; + HandleSuspendKey = "ignore"; + HandleHibernateKey = "ignore"; + }; + tlp = { enable = true;