Unexpected suspend / lid / dock / external monitor behavior

I have done a fresh install of Manjaro stable on a new Framework laptop. I am running KDE Plasma. Here is the behavior I can reproduce along with additional information that may be helpful. I’m extremely grateful for any help the community can provide.

To reproduce:

  1. Boot machine.
  2. Login via SDDM.
  3. Connect machine to Lenovo Thunderbolt 3 dock via USB-c port. Dock has two external monitors attached. As I had already done this on a previous boot, I do not need to select “Switch to external monitor” so it does that automatically. Laptop screen goes black, display comes up on external displays.
  4. Close laptop lid. Because “When laptop lid is closed” is set to Suspend, with “Even when an external monitor is attached” unchecked in the Energy Saving settings applet (for both On Battery and On AC Power), the laptop correctly does not suspend. So far, this is the desired behavior.
  5. With the laptop lid still closed, unplug the dock.

Expected:

Since the laptop is no longer connected to the external monitors and its lid is closed, the system should suspend.

Actual:

The system stays awake, even though its lid is closed.

Additional:

The workaround is to open the lid before unplugging the dock, then closing the lid. The laptop now suspends correctly. Which leads to problem #2:

To reproduce:

  1. Start with laptop suspended due to lid close.
  2. Open lid. Laptop wakes up from suspend. SDDM is presented. You may login or not, either is fine.
  3. Plug in dock. Laptop screen correctly goes black and SDDM or KDE Plasma comes up on the two external monitors.
  4. Close the lid.

Expected:

System should stay awake, even with the lid closed, as it did when these same steps were performed after the initial cold boot. I expect this because this is how the settings in Energy Saving describe it, and because that’s how it worked after the initial cold boot.

Actual:

System suspends due to lid closure, even though the external monitors (via the dock) are connected.

The lid is already closed, so there is no event to the OS, so everything stays as is so what you see is the expected behaviour…

That’s a bug. File one upstream.

:crossed_fingers: