This tip shows you how your laptop shut downs automatically when you close the lid of your laptop. This can be done when you're in the login screen or still in your desktop environment. Just follow the steps below to get this system tip working.
Open a terminal
Type the following command:
For distro's using gedit:
gksudo gedit /etc/systemd/logind.conf
For distros' using pluma:
gksudo pluma /etc/systemd/logind.conf
For distro's using leafpad:
gksudo leafpad /etc/systemd/logind.conf
Now type your password and press Enter
A textual configuration file will be opened. Search in that file for the following line:
HandleLidSwitch=ignore
Change this line into:
HandleLidSwitch=poweroff
Save the modified text file and reboot your system.
After rebooting you are now able to shutdown your laptop automatically by only closing the laptop lid.
NOTE:
This hack is at your own risk!!! It might happen that your laptop shows some unwanted side effects. These side effects could be a not properly shutting down of your laptop or overheating CPU's (this is made noticeable by an increasing system fan speed). If any kind of side effects occurs, reverse the modification by modifying the line back to HandleLidSwitch=ignore.