Ubuntu 15.04: Auto Shutdown/Hibernate When Lid Closed

Ubuntu Laptop Lid behavior

For laptop users, Ubuntu desktop only provide options “Suspend” and “Do Nothing” in its Power settings to act when the lid is closed.

If you want your laptop automatically shutdown or hibernate when you close the lid, just do below steps:

1. Open terminal from the Dash or by pressing Ctrl+Alt+T on keyboard. When it opens, run below command to edit the configuration file:

gksudo gedit /etc/systemd/logind.conf

Install gksu via Ubuntu Software Center if the command doesn’t work.

When the file opens, add one of below lines into the end and click save.

  • HandleLidSwitch=hibernate – to hibernate when lid closed
  • HandleLidSwitch=poweroff – to shutdown when lid closed
auto-shutdown-hibernate

2. After saved the file, restart systemd-logind service to apply the changes. To do so, run command:

sudo service systemd-logind restart

Finally close your laptop lid and see effect.

About ml

ml is a part time stay-at-home dad who've been using Ubuntu Desktop for a few years. He writes in the free time and wishes to share some useful tips with Ubuntu beginners and lovers.

One comment

  1. Julio E. Ortiz Sierra

    Very good tips!!! it works in my macbook air