How to Change Laptop Lid Close Action in Ubuntu Linux

|

|

The post details how to modify Ubuntu Linux’s default setting of automatically suspending when a laptop’s lid is closed. By using the ‘systemd’ and changing a command line, or installing ‘Gnome Tweaks’, users can alter the setting so closing the laptop lid doesn’t trigger sleep mode.

This post describes steps one can take to set laptop lid close behavior to ignore if the laptop lid or screen is closed in Ubuntu Linux.

Ubuntu Linux is configured to automatically suspend when the laptop lid is closed to save power. This feature has always been part of the Ubuntu Linux platform but is relatively easy to disable, so when you close the laptop screen or lid, it doesn’t sleep.

When Ubuntu Linux goes to suspend mode, it’s not turned off – go to sleep. Then, you can resume by opening the lid, and your session will continue from where you left off.

When the action is set to ignore, you can close the lid without putting the laptop to sleep while work is still being done.

How to keep the laptop on when the screen is closed in Ubuntu Linux

As described above, Ubuntu Linux will automatically suspend when you close the laptop lid to save power. You can change that so it doesn’t sleep; below is how to do that.

To stop Ubuntu Linux from suspending when the lid is closed, follow these steps:

These instructions will only work if you are using systemd.

First, press the CTRL + ALT + T keyboard shortcut to open the command console terminal.

Run the commands below:

sudo gedit /etc/systemd/logind.conf

Once the file opens, search for the line below:

#HandleLidSwitch=suspend

Then change the line to:

HandleLidSwitch=ignore

Save the file and exit.

Next, run the commands below to apply your changes.

sudo systemctl restart systemd-logind.service

Finally, you can restart your computer and test it to see if it works.

If not, continue below.

Alternatively, install Gnome Tweaks to help you control laptop lid close behavior in Ubuntu Linux.

Run the commands below to install.

sudo apt install gnome-tweaks

After installing the app, go to the Activities overview and search for Tweaks.

In the app, under General, toggle the switch to Off for Suspend when the laptop lid is closed.

That should do it!

Conclusion:

This post showed you how to configure Ubuntu Linux so that it doesn’t go to sleep when the laptop lid or screen is closed. If you find any error above or have something to add, please use the comment form below to report.

Like this:



Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.