Show Table of Contents
13.10. Preventing the Computer from Suspending when Closing the Lid
When closing the lid of your laptop, your computer suspends in order to save power. You can prevent the computer from suspending when closing the lid by changing the setting for that behavior.
Warning
Some laptops can overheat if they are left running with the lid closed, especially if they are in a confined place like a backpack. Therefore, consider if changing the default setting (suspend) is the best option in your case.
Procedure 13.10. Configuring the lid switch
- Open the
/etc/systemd/logind.conffile for editing. - Find the
HandleLidSwitch=suspendline in the file. If it is quoted out with the#character at the start, unquote it.If the line is not present in the file, add it. - Replace the default
suspendparameter withlockfor the screen to lock;ignorefor nothing to happen;powerofffor the computer to switch off.
For example:[Login] HandleLidSwitch=
lock - Save your changes and close the editor.
- Run the following command so that your changes preserve the next restart of the system:
# systemctl restart systemd-logind.serviceWarning
Keep in mind that restarting the service forcibly interrupts any currently running GNOME session of any desktop user who is logged in. This can result in users losing unsaved data.
For more information on the
/etc/systemd/logind.conf file, see the logind.conf(5) man page.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.