Ask Your Question

Close laptop lid without suspend

asked 2013-03-04 01:31:08 -0600

Shubharup gravatar image

updated 2013-03-05 21:45:35 -0600

ryanlerch gravatar image

I'm usually downloading a lot of stuff, so I keep my laptop on and the lid closed. Ever since I made the move to Cinnamon, I've been unable to close the lid without sending the laptop into suspension. How do I disable this?

edit retag flag offensive close merge delete

4 Answers

Sort by ยป oldest newest most voted

answered 2013-03-04 05:03:27 -0600

FranciscoD_ gravatar image

Via google:

How do I disable hibernate when I close my laptop lid

It would apply to disabling suspend too I would think:

Hit Alt + F2 and type in dconf-editor.

When that's open, in the left on the tree list do this:

Code: Select all
    Expand: Org
    Expand: Gnome
    Expand: settings-daemon
    Expand: Plugins
    Click: Power

    lid-close-ac-action: nothing (or your choice)
    lid-close-battery-action: nothing (or your choice)

Close dconf-editor.

Hit alt + F2 and type r and try to close the lid.

I've also read that loginctl covers lid actions now. You could take a look at man logind.conf and see if that works for you.

edit flag offensive delete link more



Assuming that the second method is to edit /etc/system/logind.conf, uncomment HandleLidSwitch and change its value to Ignore, neither method works. I suspect that this is a driver issue.

Shubharup gravatar imageShubharup ( 2013-03-04 05:36:20 -0600 )edit

The method of changing the value of "HandleLidSwitch" to "Ignore" works well for me.

skytux gravatar imageskytux ( 2013-03-04 06:41:42 -0600 )edit

And in the end, HandleLidSwitch=ignore worked for me too. I had found the solution before the FranciscoD pointed it out to me, but it had not worked. Then my friend pointed out that Linux is case sensitive, so =Ignore (capital I) wouldn't work. Thanks for the help!

Shubharup gravatar imageShubharup ( 2013-03-04 13:34:19 -0600 )edit

Neither methods worked for me. Fedora is horrible.

yanglifu90 gravatar imageyanglifu90 ( 2013-03-05 22:37:54 -0600 )edit

@yanglifu90: horrible are you that can not make it work :)

skytux gravatar imageskytux ( 2013-03-06 06:47:21 -0600 )edit

answered 2015-03-26 04:45:24 -0600

hedayat gravatar image

Personally, I usually prefer my laptop to be suspended when I close the lid; however, there are times that I want it to keep working when I close the lid, e.g. when I'm downloading stuff.

Apparently, it is ideal to educate such applications (e.g. curl, aria2, others!) to "inhibit" suspension when they are active; but you can also inhibit suspension manually when running such things using systemd-inhibit. For example, if I want to download something using wget, I'll do it like this:

systemd-inhibit --what=handle-lid-switch --who="My Lid-Close-Suspend Inhibitor" --why="Downloading" --mode=block wget http://some/url/to/get

Then I can close my laptop's lid and it won't suspend while wget is running. As a bonus, it'll suspend when download finishes, which is what you won't get with above solutions which prevents suspension completely when the lid is closed (well, yes you can run pm-suspend to suspend).

If you have multiple processes for which you want to prevent suspension, you can run each one with systemd-inhibit, and the laptop will suspend when all inhibitors are terminated.

As another example, I've free Internet access at nights (e.g. from 1 AM to 7 AM), so I want to download stuff during this period but not after that, and I prefer that my laptop suspends in the morning (at 7 AM). Therefore, I run:

systemd-inhibit --what=handle-lid-switch --who="My Lid-Close-Suspend Inhibitor" --why="FreeInternet" --mode=block sleep 15h

And I have a cron job which will killall systemd-inhibit processes.

edit flag offensive delete link more


thats perfect, exactly what i needed.

arti gravatar imagearti ( 2015-03-30 06:45:08 -0600 )edit

You're welcome. :)

hedayat gravatar imagehedayat ( 2015-03-30 14:02:21 -0600 )edit

Please explain the code.... and how to disable the feature once I decide to stop it?

SantoshHoropter gravatar imageSantoshHoropter ( 2015-04-03 14:53:39 -0600 )edit

Which part needs explanation? Also, probably you'll find the answers at man systemd-inhibit. However: who and why are arbitrary descriptions; what says what we are inhibiting, and block mode says that it should block that action (rather than delay).

Also, terminating sytemd-inhibit process is enough to stop its behavior. Also, it stops once the command (e.g. wget or sleep command in above examples) terminates.

hedayat gravatar imagehedayat ( 2015-04-03 16:46:50 -0600 )edit

answered 2015-03-26 00:12:54 -0600

sheeshmohsin gravatar image

updated 2015-03-26 00:16:12 -0600


For GNOME, this is now handled by systemd in Fedora 18+.

As root, edit /etc/systemd/logind.conf. You're looking for the definition for HandleLidSwitch, it may be commented out.

The default is: HandleLidSwitch=suspend

You can set it to ignore, poweroff, reboot, halt, suspend, hibernate, hybrid-sleep, lock or kexec. Since your laptop screen is broken, you just want to set it to ignore, so add this to /etc/systemd/logind.conf:


Then, run systemctl restart systemd-logind, or simply reboot for it to take effect.

edit flag offensive delete link more


Worked for me in Fedora 23 as well.

shimon001 gravatar imageshimon001 ( 2015-12-09 06:55:52 -0600 )edit

This worked in Fedora 23, with one extra warning: running _systemctl restart systemd-logind_ makes the screen go blank, perhaps because I use i3wm, so probably better rebooting.

Giacecco gravatar imageGiacecco ( 2016-04-05 13:50:16 -0600 )edit

answered 2016-08-27 17:18:26 -0600

juradx gravatar image

Just install Gnome Tweak Tool using the "Software" app. This tool is in the official repository.

Run it and open "Power" tab. You will see the "When laptop lid is closed" option there.

Tested on Fedora 24.

Tweak Tool screenshot

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-03-04 01:31:08 -0600

Seen: 25,425 times

Last updated: Aug 27 '16