Source : How to Change Lid Close Behavior in Ubuntu 20.04
1. Open a new shell session
2. Run command to open file
sudo gedit /etc/systemd/logind.conf
3. Edit the file to enable hibernate on closing lid
When the file is opened, search for the following line
#HandleLidSwitch=suspend
remove the #
to enable the setting and save the changed document
You can also choose one of the following options if suspend is not what you are looking for
HandleLidSwitch=lock – lock when lid closed.
HandleLidSwitch=ignore – do nothing.
HandleLidSwitch=poweroff – shutdown.
HandleLidSwitch=hibernate – hibernate Ubuntu.
4. Apply the changes
Apply the changes by restarting the service
systemctl restart systemd-logind.service
Your system should suspend/hibernate now when you close the lid of your laptop
If you want to verify if the option you chose is available on your device you can run
sudo systemctl hibernate/suspend/lock
Top comments (0)