Thinkpad T450 running Ubuntu 17.10 which was clean-installed (not upgraded) some weeks back. I frequently moved from room to room and like the laptop to go to sleep when I close the lid. It seems to never do this, staying awake all the time. I have to hold down the power button in the indicator and choose the pause icon to suspend it. Previous releases of Ubuntu used to "Just Work".
I have tried toggling the option in Tweaks to ensure it is set to suspend on lid close, but this makes no difference. Is this a bug or expected behaviour?
Turns out we were all wrong. The magnet which triggers the lid sensor had come away inside the laptop. I confirmed this by holding a fridge magnet up to the camera. As soon as I did that, the laptop suspended fine. So I figured there's a magnet in the base. There was, but it was floating around (clinging to the battery) inside the machine. I put it back in place and it's now working.
We can catch the lid open/close events and could bind scripts to them by using
acpid
- Advanced Configuration and Power Interface event daemon.dconf-editor
to disable the lid close action. But unfortunately I can't disable this action... So I just hope this could help you.1. Catch the events. Execute one of the next commands, then close and open the lid:
acpi_listen
ornetcat -U /var/run/acpid.socket
. Here is an example output:2. Configure
acpid
to recognize the events triggered when the device mode is changed. Create the following files (don't forgot to use the actual events from the above step):/etc/acpi/events/lid-close
:/etc/acpi/events/lid-open
:3. Restart
acpid
so it can re-read the event filters, including the ones we just added:4. Create the script
/etc/acpi/lid-actions.sh
(and make it executable) that will suspend the laptop when the lid is close1
. I don't have idea what action could be useful when the lid is going to be open0
, so these lines are commented.References:
The fastest way is by using the default settings manager
Settings>Power Management>When laptop lid closed
P.s : why use ubuntu tweaks when there is a option to do it in default settings app