chiark / gitweb /
logind: when we wake up from suspend and the lid is still closed, go to sleep immedia...
authorLennart Poettering <lennart@poettering.net>
Fri, 21 Feb 2014 20:10:00 +0000 (21:10 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 21 Feb 2014 20:13:53 +0000 (21:13 +0100)
commited4ba7e4f652150310d062ffbdfefb4521ce1054
treeefe82ddb0c91dac49e752e91fe6e500731a7cfd6
parent6e9feda30d6d5c4aa9908d458c92eb0daf90eb3a
logind: when we wake up from suspend and the lid is still closed, go to sleep immediately again

This is quite useful on laptops such as the Lenovo Yoga, where the power
button is placed on the front side of the laptop and can be pressed by
accident even if the lid is closed.

This reworks a bit of the logind logic to repeatedly try to suspend the
system as long as a lid is closed. We use the new "post" event source
for this, so that we don't keep things busy.

This also adds some code to check the lid status on boot, so that a
powered-off machine that is accidentaly powered on goes into suspend
immediately.

Yay! From now on I can put my Yoga safely in my backpack without fearing
that it might turn itself on and drain the battery.
src/login/logind-action.c
src/login/logind-button.c
src/login/logind-button.h
src/login/logind.c