My case: At work, I use my own laptop (Xiaomi Mi Pro). When I connect it to an external monitor, I want to be able to just close the lid and leave without the laptop and have the laptop suspend. When I return, I want to continue working.

But it's not that simple when an external monitor is attached. The default behaviour of Linux with multiple desktop environments is to change the primary monitor to the external.

For example: Ubuntu 18.04.1. Its dconf option lid-close-suspend-with-external-monitor doesn't work. Nothing changes when I set that option to true. Sometimes Ubuntu couldn't recognize that external monitor at all. This problem suddenly appeared and disappeared, so I abandoned Ubuntu.

Now I'm using Mint 19 with Cinnamon. It has the necessary option in the power settings (actually the same dconf option lid-close-suspend-with-external-monitor, but in the cinnamon section). And it works, but when I open the lid, the windows from the laptop screen move to the external monitor. Having to move them back to workplaces is time consuming and undesirable.

I think that before laptop suspends, xrandr has time to change the primary monitor to external. How can I prevent this behavior. Can I lock the primary laptop monitor? Or maybe it is possible to restore the position of the windows after opening the lid?

  • When you are at your office, what do you use that external monitor for? Just as a test, does the bad behaviour occur when you set the external to mirror the internal display? – K7AAY Aug 21 '18 at 16:41
  • Basically, I output additional windows to the external monitor. But on presentations I use the mirror mode. In mirror mode, the screens are duplicated, so there is no problem with the position of the windows. – Константин Башаркевич Aug 21 '18 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.