I'm running NixOS with KDE Plasma, Plasma Login Manager, and a ThinkPad X1 Carbon connected to an external monitor. I want the built-in display to remain off whenever the lid is closed, while continuing to use the external monitor. At the moment, the external display works initially, but after a few minutes the laptop panel turns back on. I can see it light up by slightly lifting the lid. I tried configuring systemd-logind to ignore lid events and rebooted, but it didn't solve the problem. I'm also using the Lenovo ThinkPad hardware module. What configuration should I use to keep the system in clamshell mode?
2 Answers
Use the exact systemd-logind option names with capital letters. On NixOS, try setting the lid actions like this: `services.logind.settings.Login = { HandleLidSwitch = "ignore"; HandleLidSwitchExternalPower = "ignore"; HandleLidSwitchDocked = "ignore"; LidSwitchIgnoreInhibited = "no"; };` The lowercase versions may not be recognized. Also check KDE’s Power Management settings and make sure closing the lid is set to do nothing, since KDE can apply its own policy after logind handles the initial event.
There are two separate parts here: logind decides what to do with the lid switch, while KDE can still react to the lid event later. Configure all three `HandleLidSwitch` settings using the capitalized names, then set KDE’s lid-close action to “Do nothing.” That should prevent the internal panel from being re-enabled while the external monitor remains active.

This is especially worth checking under Wayland, where KDE’s power-management service may override what logind initially did. Disable any KDE action associated with closing the lid and then restart the relevant session or reboot.