I don’t prefer my laptop to switch to suspend state when my laptop lid is closed. So I found an easy way to disable suspend when lid is close.

Here is how is it done:

Open Terminal
type in the command below (as root)Code language: JavaScript (javascript)
sudo gedit /etc/systemd/logind.conf

Now the logind.conf file will open in Gedit text editor
set the variable “HandleLidSwitch” to “ignore”, as in the example below:

[Login] 
#NAutoVTs=6 
#ReserveVT=6 
#KillUserProcesses=no 
#KillOnlyUsers= 
#KillExcludeUsers=root 
#Controllers= 
#ResetControllers=cpu 
#InhibitDelayMaxSec=5 
#HandlePowerKey=poweroff 
#HandleSuspendKey=suspend 
#HandleHibernateKey=hibernate
#PowerKeyIgnoreInhibited=no 
#SuspendKeyIgnoreInhibited=no 
#HibernateKeyIgnoreInhibited=no 
#LidSwitchIgnoreInhibited=yesCode language: PHP (php)

Example below

[Login] 
#NAutoVTs=6 
#ReserveVT=6 
#KillUserProcesses=no 
#KillOnlyUsers= 
#KillExcludeUsers=root 
#Controllers= 
#ResetControllers=cpu 
#InhibitDelayMaxSec=5 
#HandlePowerKey=poweroff 
#HandleSuspendKey=suspend 
#HandleHibernateKey=ignore
#PowerKeyIgnoreInhibited=no 
#SuspendKeyIgnoreInhibited=no 
#HibernateKeyIgnoreInhibited=no 
#LidSwitchIgnoreInhibited=yesCode language: PHP (php)
Now reboot

With this change, reboot your system and feel free to close your laptop lid that it will no longer go to sleep. Now you are done!

Enjoy!

I compiled a list of software and services that I use to improve my workflow, here is the link to the list.

Darryl Dias

I’m Darryl. I’m a 3D Artist, Programmer and Linux enthusiast. On this site I share my insights, tips and tricks, tutorials, methods and best practices.