diff options
author | Mattias Eriksson <snaggen@mayam.com> | 2018-04-17 09:54:02 +0200 |
---|---|---|
committer | Mattias Eriksson <snaggen@mayam.com> | 2018-05-13 00:30:09 +0200 |
commit | 8fbafbfab5671d56dd469f2205b7906c4a7f7c7c (patch) | |
tree | ab4eab0020d97dc5091b72479c383989ccc84729 /sway/config | |
parent | 9d607b72532096e469fdaccf474836c310b629ff (diff) |
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
Diffstat (limited to 'sway/config')
-rw-r--r-- | sway/config/output.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sway/config/output.c b/sway/config/output.c index 68022278..ee2440ea 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -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) { |