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=yes
Code 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=yes
Code 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!