Idle handling for dpms/lockscreen et al

Swayidle handles idle events and allows
for dpms and lockscreen handling. It also
handles systemd sleep events, and can
raise a lockscreen on sleep

Fixes #541
This commit is contained in:
Mattias Eriksson 2018-04-17 09:54:02 +02:00
parent 9d607b7253
commit 8fbafbfab5
16 changed files with 703 additions and 2 deletions

View file

@ -81,6 +81,9 @@ void merge_output_config(struct output_config *dst, struct output_config *src) {
free(dst->background_option);
dst->background_option = strdup(src->background_option);
}
if (src->dpms_state != 0) {
dst->dpms_state = src->dpms_state;
}
}
static void set_mode(struct wlr_output *output, int width, int height,
@ -204,6 +207,20 @@ void apply_output_config(struct output_config *oc, struct sway_container *output
execvp(cmd[0], cmd);
}
}
if (oc && oc->dpms_state != DPMS_IGNORE) {
switch (oc->dpms_state) {
case DPMS_ON:
wlr_log(L_DEBUG, "Turning on screen");
wlr_output_enable(wlr_output, true);
break;
case DPMS_OFF:
wlr_log(L_DEBUG, "Turning off screen");
wlr_output_enable(wlr_output, false);
break;
case DPMS_IGNORE:
break;
}
}
}
void free_output_config(struct output_config *oc) {