Plasma 6: Disabling lid switch action on-demand?

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