Kiến Thức Linux

Ubuntu 16.10: Auto Shutdown / Hibernate When Lid Closed

Ubuntu Laptop Lid behavior

Ubuntu Laptop Lid behavior

For those running Ubuntu 16.10 on laptops, there are only two choices, suspend and do nothing in Power settings for changing the laptop lid close behavior.

If you want to automatic shutdown or hibernate your laptop when lid is closed, here is the step by step how to guide.

1. Open Ubuntu Software, search for and install dconf editor.

install-dconf-editor

For command line, you can run the command below in terminal to install dconf-editor:

sudo apt install dconf-editor

2. Launch dconf Editor and navigate to org -> gnome -> settings daemon -> plugins -> power. Then do:

  • Double click “lid-close-ac-action” line
  • Turn off use default value.
  • Change Custom value to ANYTHING other to the default
  • Do same to “lid-close-battery-action

Although step 2 does not really change the lid close action, it is required before doing following steps in some conditions!

dconf-lid-close-action

3. Open terminal (Ctrl+Alt+T) and run command to open and edit the config file:

sudo apt install gksu && gksudo gedit /etc/systemd/logind.conf

When it opens, find out the line #HandleLidSwitch=suspend, un-comment and change it into:

  • HandleLidSwitch=poweroff to automatic shutdown when lid is closed.
  • HandleLidSwitch=hibernate to automatic hibernate when lid is closed.

You can also change the value to suspend or ignore though they are already available in power settings.

lid-close-action

To apply changes, restart your laptop or run command in terminal to restart the logind service:

systemctl restart systemd-logind.service

Đăng ký liền tay Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !

Add Comment

Click here to post a comment

Đăng ký liền tay
Nhận Ngay Bài Mới

Subscribe ngay

Cám ơn bạn đã đăng ký !

Lỗi đăng ký !