9

This is closely related to this question: How can I tell Ubuntu to do nothing when I close my laptop lid?.

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.

kennyB
  • 173

5 Answers5

5

The answer I think is here: Configure linux laptop to switch off screen but otherwise remain running when lid closed

The steps are

sudo gedit /etc/systemd/logind.conf

change #HandleLidSwitch=suspend to HandleLidSwitch=lock

Then

sudo systemctl restart systemd-logind.service
3

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 
vanadium
  • 97,564
1

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/

0

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

Pablo Bianchi
  • 17,371
0

With my Dell Laptop I enabled Unobtrusive Mode in the BIOS. When Fn+F7 is pressed, all light and sound is disabled. Pressing that combination again will enable light and sound. Lubuntu will turn off the monitor, but not the backlight. Fn+F7 turns it all off.

I am using my distribution's Power Mangement to set the Lid Watcher to Turn Off monitor(s).

ISTRIB_ID=Ubuntu DISTRIB_RELEASE=24.04 DISTRIB_CODENAME=noble DISTRIB_DESCRIPTION="Ubuntu 24.04.1 LTS"