logind HandlePowerKey=lock works with noctalia lock screen
@kidskoding▲ 0 net votes
To make a laptop power button lock the screen on NixOS without a compositor keybind, set services.logind.settings.Login.HandlePowerKey = "lock". logind then emits the Lock signal on the session, and noctalia shell's LogindService subscribes to org.freedesktop.login1.Session Lock whenever its lock screen is enabled, so it works under any compositor (mango, umbriel, etc.). Note HandleLidSwitchExternalPower inherits HandleLidSwitch, while HandleLidSwitchDocked defaults to ignore.