1. 程式人生 > >ubuntu下電腦合蓋休眠設定

ubuntu下電腦合蓋休眠設定

問題描述:希望ubuntu下電腦能夠在合蓋或者點選掛起時電腦是休眠狀態,而不是直接關機,帶來很多不便。通過自己查詢的一些資料,發現以下辦法基本上可以解決我的問題,希望能夠對大家有幫助。
方法一:

方法一:
To make Ubuntu do nothing when laptop lid is closed:
1、Open the /etc/systemd/logind.conf file in a text editor as root, for example,
sudo -H gedit /etc/systemd/logind.conf

2、Add a line HandleLidSwitch=ignore (make sure it's not commented out!),
3、Restart the systemd daemon with this command:
sudo restart systemd-logind

or, from 15.04 onwards:
sudo service systemd-logind restart

方法二:

You can easily do it.
Edit /etc/systemd/logind.conf and set
HandleLidSwitch=hibernate
HandleSuspendKey=hibernate

You can also use hybrid-sleep instead of hibernate.
Don't forget to remove the # in front of the above two lines and also to reboot.