How to prevent the computer from suspension when laptop lid closed

by admin July 20, 2018 at 10:26 am

How to prevent the computer from suspension when laptop lid closed

If you close the lid, the computer will get into suspension mode in order to save the power. This can be avoided by making changes in config file /etc/systemd/logind.conf as shown below.

# Edit the file /etc/systemd/logind.conf

Search for following line.

HandleLidSwitch=suspend

If this parameter is commented out then uncomment it and replace with any one of the below option as per your requirement.

lock - System will be locked
ignore - Nothing will happen
poweroff - Computer will be powered off

For Eg:-

HandleLidSwitch=lock

This option will lock the system when lid is closed.

Finally restart the logind service to take affect the changes made.

#systemctl restart systemd-logind.service

Note :

Restaring logind service will terminate any open gnome session which leads to lose the unsaved data.

Add Comment