summaryrefslogtreecommitdiff
path: root/src/login/logind-action.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-21 21:10:00 +0100
committerLennart Poettering <lennart@poettering.net>2014-02-21 21:13:53 +0100
commited4ba7e4f652150310d062ffbdfefb4521ce1054 (patch)
treeefe82ddb0c91dac49e752e91fe6e500731a7cfd6 /src/login/logind-action.c
parent6e9feda30d6d5c4aa9908d458c92eb0daf90eb3a (diff)
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.
Diffstat (limited to 'src/login/logind-action.c')
-rw-r--r--src/login/logind-action.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/login/logind-action.c b/src/login/logind-action.c
index 7744addf6..3bad92271 100644
--- a/src/login/logind-action.c
+++ b/src/login/logind-action.c
@@ -80,6 +80,10 @@ int manager_handle_action(
/* Locking is handled differently from the rest. */
if (handle == HANDLE_LOCK) {
+
+ if (!is_edge)
+ return 0;
+
log_info("Locking sessions...");
session_send_lock_all(m, true);
return 1;