Score:5

How can I tell Ubuntu to only turn the screen off when I close my laptop lid?

cn flag

This is closely related to this question.

I would like to stop Ubuntu from suspending or sleeping when the laptop lid is closed, while still turning the screen off to save power. How can I do that?

This is for a Dell Precision 5550 running Ubuntu 20.04 preinstalled.

in flag
Which version of Ubuntu are you using, and what brand and model of notebook are you using? Depending on the combination, it might be as simple as a single setting
Will avatar
id flag
I think it’s answered here https://askubuntu.com/questions/1358045/how-do-you-disable-the-laptop-lid-switch-in-ubuntu-20-04 - whilst it says it disables the lid switch, it does turn the screen off.
kennyB avatar
cn flag
@Will that solution does not work for me. It successfully stops the computer from sleeping but the screen stays on.
Someone avatar
my flag
Your question is unclear, It needs more information like your specs, os information and what exactly you want. As it is currently written, It is hard to tell what exactly is the problem
Score:2
cn flag

The answer I think is here.

The steps are

sudo gedit /etc/systemd/logind.conf

change #HandleLidSwitch=suspend to HandleLidSwitch=lock

Then

sudo systemctl restart systemd-logind.service
kennyB avatar
cn flag
This one didn't work for me sorry
Score:1
ca flag

You already have part of the answer. You do need to edit logind.conf to make sure the laptop doesn't sleep when closing the lid. The second part is you need to set the backlight to turn off after a given amount of time. Edit your /etc/default/grub. Find the line GRUB_CMDLINE_LINUX_DEFAULT= and change it to GRUB_CMDLINE_LINUX_DEFAULT=consoleblank=600 or whatever timeout you like, in seconds. Don't forget to update-grub and reboot.

That's what I have always used, but if you specifically want to turn the screen off when you close the lid, you might also want to look here...https://mensfeld.pl/2018/08/ubuntu-18-04-disable-screen-on-lid-close/

Score:1
cn flag

These settings are not exposed in the Settings dialog, but can be changed with commands or using dconf Editor. Following commands will cause the computer turn off the screen when you close the lid:

gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action 'blank'
gsettings set org.gnome.settings-daemon.plugins.power lid-close-battery-action 'blank'

As you see, you can set different actions depending on whether the computer is on AC power (lid-close-ac-action) or on battery power (lid-close-battery-action). Available actions are blank, suspend, shutdown, hibernate, interactive, nothing and logout.

To reset to default, specify reset in the command and leave out the final argument, e.g.

gsettings reset org.gnome.settings-daemon.plugins.power lid-close-ac-action 
Score:0
jm flag

Simple GUI method

Just need to install GNOME Tweaks and it works well for Ubuntu

Open terminal and install gnome-tweaks and open it.

sudo apt update
sudo apt install gnome-tweaks
gnome-tweaks

After that you can see an option which is Suspend when laptop lid is closed. You just need to disable that option like below image.

gnome-tweaks-menu

vanadium avatar
cn flag
Still, how to blank the screen instead?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.