Plasma 6: Disabling lid switch action on-demand?

In Plasma 5, I was able to enable or disable sleep on lid close by switching activities with a keyboard shortcut.

Now in Plasma 6 with activity-specific energy settings gone, I am unable to do this. Is there an easy way to quickly choose whether my laptop will go to sleep or not whenever the lid is closed?

I have similar problem. Any power setting seems to blank my external monitor when the laptop lid is closed. It worked fine in the last version of plasma 5. Nothing else has changed on my laptop so I am assuming it is some sort of bug with these settings. Otherwise Plasma 6 and the HDR look great on my monitor.

Try it out, I fixed this when switching from 5.25 to 5.26. But I have stopped switching off when closing the lid, and perhaps your example will be found.

No easy way right now, I’m afraid. Here’s one solution I could think of, involving custom scripts.

  • Replace LidAction=<x> lines in your ~/.config/powerdevilrc config file with LidAction=0 (meaning “no action”) with a script, and set them back to the original value with another script (or a different argument for the same script).
    • The KDE power management service will reload its settings whenever the config file is changed.
    • Activities can have scripts associated to them when switching. Not currently exposed in System Settings, but easy to add for people who know about this. Put your config file modification script(s) there.

Alternatively, one could permanently set the lid switch action in System Settings to None and implement a KWin plugin to listen for lid switch events as well as Activity switching. Seems to me though that this approach would be more work.

Changing systemd settings for HandleLidSwitch* won’t do much, I believe, because KDE’s power management service sets a “handle-lid-switch” inhibitor for systemd while the session is active. To replace all of systemd’s lid switch handling with Plasma’s own behaviors.

1 Like

We now have Bug 485623 which is related to this topic in that it would allow lid switch inhibition with systemd-inhibit as opposed to changing the LidAction properties in the powerdevilrc config file.