Ubuntu Linux

Disable Laptop Suspend When Lid Closes in Ubuntu

Richard
Written by
Richard
Sep 5, 2022 Updated Mar 22, 2026 3 min read
Disable Laptop Suspend When Lid Closes in Ubuntu

This post describes steps 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 automatically suspends when you close the laptop lid to save power. You can change that so it doesn’t sleep; below is how.

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:

🐧Bash / Shell
sudo gedit /etc/systemd/logind.conf

Once the file opens, search for the line below:

💻Code
#HandleLidSwitch=suspend
Ubuntu logind.conf file with HandleLidSwitch set to ignore

Then change the line to:

💻Code
HandleLidSwitch=ignore
Ubuntu terminal showing HandleLidSwitch=ignore configuration change

Save the file and exit.

Next, run the commands below to apply your changes.

🐧Bash / Shell
sudo systemctl restart systemd-logind.service

Finally, you can restart and test your computer 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.

🐧Bash / Shell
sudo apt install gnome-tweaks

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

Ubuntu Tweaks application search and launch screen

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

Ubuntu Tweaks power settings showing lid close action options

That should do it!

Conclusion:

  • Ubuntu Linux provides a straightforward way to change the laptop lid close behavior to “ignore,” allowing users to avoid automatic suspension when the lid is closed.
  • Modifying the HandleLidSwitch parameter in the login.conf file or utilizing the Gnome Tweaks application, users can keep their laptop running even when the screen is closed.
  • With these simple steps, Ubuntu Linux users can ensure their work continues uninterrupted when the laptop lid is closed, providing greater flexibility and control over power management.

Frequently Asked Questions

How do I disable laptop suspend when the lid closes in Ubuntu?

To disable laptop suspend when the lid closes in Ubuntu, open the terminal and edit the logind.conf file by running 'sudo gedit /etc/systemd/logind.conf'. Change the line '#HandleLidSwitch=suspend' to 'HandleLidSwitch=ignore', save the file, and restart the systemd-logind service.

What happens when I close the laptop lid after changing the settings?

After changing the settings to 'ignore', closing the laptop lid will no longer trigger the suspend mode. This allows you to keep your laptop running while the lid is closed, enabling you to continue your work without interruption.

Can I use Gnome Tweaks to manage lid close behavior in Ubuntu?

Yes, you can use Gnome Tweaks to manage lid close behavior in Ubuntu. After installing Gnome Tweaks, go to the Activities overview, search for Tweaks, and toggle the 'Suspend when laptop lid is closed' option to Off.

Is it safe to ignore the lid close action on my laptop?

Ignoring the lid close action is generally safe, especially if you want to keep your laptop running for tasks like downloads or updates. However, be mindful of heat management, as laptops can overheat if left closed for extended periods.

What should I do if the changes don't take effect?

If the changes don't take effect, ensure you saved the logind.conf file correctly and restarted the systemd-logind service. You may also try restarting your laptop to apply the changes fully.

Was this guide helpful?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, the owner and lead writer at Geek Rewind, is a tech enthusiast passionate about simplifying complex IT topics. His years of hands-on experience in system administration and enterprise IT operations have honed his ability to provide practical insights and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

2457 articles → Twitter

📚 Related Tutorials

Install Joomla with Lighttpd on Ubuntu 24.04
CMS Install Joomla with Lighttpd on Ubuntu 24.04
How to Change Your Profile Picture in Ubuntu Linux
Ubuntu Linux How to Change Your Profile Picture in Ubuntu Linux
How to Change Screen Timeout in Ubuntu Linux
Ubuntu Linux How to Change Screen Timeout in Ubuntu Linux
How to Install mcrypt PHP Module on Ubuntu 24.04
Ubuntu Linux How to Install mcrypt PHP Module on Ubuntu 24.04

Leave a Reply

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