fix: use valid shoukei logind keys

This commit is contained in:
Ryan Yin
2026-09-03 23:26:03 +08:00
parent 7661be6a69
commit 83833bf871
3 changed files with 33 additions and 5 deletions
+5 -5
View File
@@ -54,13 +54,13 @@
#
# NOTE: Hibernate is not supported by Asahi Linux.
services.logind.settings.Login = {
lidSwitch = "suspend";
lidSwitchExternalPower = "lock";
HandleLidSwitch = "suspend";
HandleLidSwitchExternalPower = "suspend";
# 'Docked' means: more than one display is connected or the system is inserted in a docking station
lidSwitchDocked = "ignore";
HandleLidSwitchDocked = "ignore";
powerKey = "suspend";
powerKeyLongPress = "poweroff";
HandlePowerKey = "suspend";
HandlePowerKeyLongPress = "poweroff";
};
systemd.targets.sleep.enable = true;
systemd.sleep.settings.Sleep = {
@@ -0,0 +1,10 @@
{ ... }:
{
lidSwitch = "suspend";
lidSwitchExternalPower = "suspend";
lidSwitchDocked = "ignore";
powerKey = "suspend";
powerKeyLongPress = "poweroff";
oldLowercaseKeysAbsent = true;
}
@@ -0,0 +1,18 @@
{ outputs, ... }:
let
login = outputs.nixosConfigurations.shoukei-niri.config.services.logind.settings.Login;
in
{
lidSwitch = login.HandleLidSwitch or null;
lidSwitchExternalPower = login.HandleLidSwitchExternalPower or null;
lidSwitchDocked = login.HandleLidSwitchDocked or null;
powerKey = login.HandlePowerKey or null;
powerKeyLongPress = login.HandlePowerKeyLongPress or null;
oldLowercaseKeysAbsent =
!(login ? lidSwitch)
&& !(login ? lidSwitchExternalPower)
&& !(login ? lidSwitchDocked)
&& !(login ? powerKey)
&& !(login ? powerKeyLongPress);
}