There are several reasons for wanting our laptop does not change state when lowering the screen, that is, it continues to work without shutting down or going to sleep. The main reason is that you will be using your laptop as a tower, connecting an external display and other peripherals such as a USB keyboard and mouse.
This summer to work I have preferred to connect the Benq LED monitor that you see in the image, which is bigger and looks much better than the TFT of my old Dell XPS 15 that is 12 or 13 years old and I had to configure it. It's not difficult, but since it doesn't appear in the configuration menu, you have to do it by editing a file.
From display settings
Depending on your Linux distribution and your desktop, the behavior of the screen when closing the lid is graphically configurable from Settings > Power Options.
If it is not, you can change it by modifying a file with the terminal as I indicate below.
Modifying Systemd's logind.conf
The steps to change Ubuntu settings and get it working are as follows. I have used it with Ubuntu 18.04.
We open the terminal and open the logind.conf with the following command
sudo nano /etc/systemd/logind.conf
We look for this line
and we change it to
It will be as in the picture.
We save and close. Remember that with the Nano editor, you save with the Ctrl+O keys, pressing them will activate the file name, we hit enter to confirm as in the image
and then ctrl+x to exit
Finally if we have to restart systemd with
sudo systemctl restart systemd-logind
If for some reason it doesn't work for you, try doing the same and also put
If you have any questions, leave a comment.