From 1063a895410c25d0cecc1409e8155663da6edbd6 Mon Sep 17 00:00:00 2001 From: Colin Date: Sun, 17 Dec 2023 21:08:16 +0000 Subject: [PATCH] powerbutton/lid-switch: tune the desired actions --- hosts/common/hardware/default.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hosts/common/hardware/default.nix b/hosts/common/hardware/default.nix index e07287a7..15dbf046 100644 --- a/hosts/common/hardware/default.nix +++ b/hosts/common/hardware/default.nix @@ -64,8 +64,12 @@ powerManagement.cpuFreqGovernor = "ondemand"; services.logind.extraConfig = '' - # don’t shutdown when power button is short-pressed - HandlePowerKey=ignore + # see: `man logind.conf` + # don’t shutdown when power button is short-pressed (commonly done an accident, or by cats). + # but do on long-press: useful to gracefully power-off server. + HandlePowerKey=lock + HandlePowerKeyLongPress=poweroff + HandleLidSwitch=lock ''; # some packages build only if binfmt *isn't* present