summaryrefslogtreecommitdiff
path: root/src/login/logind-button.h
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-button.h
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-button.h')
-rw-r--r--src/login/logind-button.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/login/logind-button.h b/src/login/logind-button.h
index 824106cd24..e85aa81d0a 100644
--- a/src/login/logind-button.h
+++ b/src/login/logind-button.h
@@ -30,17 +30,18 @@ typedef struct Button Button;
struct Button {
Manager *manager;
- sd_event_source *event_source;
+ sd_event_source *io_event_source;
+ sd_event_source *check_event_source;
char *name;
char *seat;
int fd;
- bool lid_close_queued;
+ bool lid_closed;
};
Button* button_new(Manager *m, const char *name);
void button_free(Button*b);
int button_open(Button *b);
-int button_recheck(Button *b);
int button_set_seat(Button *b, const char *sn);
+int button_check_lid(Button *b);