-
Open the
/etc/systemd/logind.conf
file for editing. -
Find the
HandleLidSwitch=suspend
line 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
suspend
parameter with-
lock
for the screen to lock; -
ignore
for nothing to happen; -
poweroff
for the computer to switch off.
For example:
HandleLidSwitch=lock HandleLidSwitchExternalPower=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.service
---END---