I use Ubuntu 18.04.3 gnome laptop with a second monitor connected with HDMI. If I close the lid of my laptop it successfully locks (after I reopen it I have to type my password) but the windows opened on my second screen stay in place. I mean they can be seen after the lid is closed. I want them to go away in that situation (the second screen must go black), how do I do that?

  • Interesting question. Unfortunately, I don't have an answer. – user1100215 Feb 9 at 21:41
  • I wasn't able to reproduce your problem (on ubuntu 20.04), when i have a second screen attached the action of closing the lid doesn't lock my laptop, but instead moves all windows on the second monitor. Anyway have you tried playing with gnome tweaks (download from store)? there is a workspace section there, it might help you enabling the option "workspaces span displays". – Niccco Jul 2 at 18:32

If you change the primary display to your Built-In display, it does it automatically. I use a tv as a second monitor and this seemed to work for me. The tv only went blank but did not turn off.

Screen Display Menu

| improve this answer | |
  • Doesn't work for me – Azatik1000 Jul 2 at 20:34

If you don't mind a slightly longer startup time, you can set your laptop to hibernate rather than suspend when you close the lid. If you want to try this, you can follow the directions on this article - https://tipsonubuntu.com/2018/04/28/change-lid-close-action-ubuntu-18-04-lts/. I've copied them below.

First, open the terminal and run:

sudo gedit /etc/systemd/logind.conf

In the configuration file that opens up, there should be a line that reads:


You want to change that to:


(Remove the "#" and replace "suspend" with "hibernate")

Afterwards, save the configuration file. For the changes to take effect, go back to your terminal window and run:

systemctl restart systemd-logind.service

Your laptop should then hibernate rather than suspend when you close the lid, and it shouldn't be able to output any image while hibernating.

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.