This simple tutorial is going to show you how to change the laptop lid close actions, including suspend, hibernate, do noting, and shutdown when the lid is closed in Ubuntu. In Ubuntu 12.10 & 12.04, hibernate is disabled by default, so this handy tutorial will also show you how to enable hibernate.
Here we go:
1.) To enable hibernate in Ubuntu 12.04 and Ubuntu 12.10. Hit Ctrl+Alt+T to launch a terminal, then run this command to create a hibernate policy file:
gksudo gedit /var/lib/polkit-1/localauthority/50-local.d/hibernate.pkla
Then copy and paste following into the file and save.
Need to restart to take effect.
2.) Now head to System Settings -> Power, there you can set laptop to suspend, hibernate, or do nothing when the lid is closed.
3.) If you want the laptop shutting down when the lid is closed, first install dconf-tools:
sudo apt-get install dconf-tools
Then launch Dconf-Editor from the dash, navigate to org -> gnome -> settings daemon -> plugins -> power. Change the value of “lid-close-battery-action” to Shutdown. Actually, when you change the settings in Power (see previous picture), it automatically changes the value in this picture.