diff --git a/sway/config/output.c b/sway/config/output.c index aa53fc46..74d79130 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -178,12 +178,21 @@ void apply_output_config(struct output_config *oc, struct sway_output *output) { struct wlr_output *wlr_output = output->wlr_output; if (oc && oc->enabled == 0) { - if (output->bg_pid != 0) { - terminate_swaybg(output->bg_pid); - output->bg_pid = 0; + if (output->enabled) { + if (output->bg_pid != 0) { + terminate_swaybg(output->bg_pid); + output->bg_pid = 0; + } + output_disable(output); + wlr_output_layout_remove(root->output_layout, wlr_output); + } + wlr_output_enable(wlr_output, false); + return; + } else if (!output->enabled) { + if (!oc || oc->dpms_state != DPMS_OFF) { + wlr_output_enable(wlr_output, true); } - output_disable(output); - wlr_output_layout_remove(root->output_layout, wlr_output); + output_enable(output, oc); return; } @@ -251,7 +260,7 @@ void apply_output_config(struct output_config *oc, struct sway_output *output) { free(command); } } - if (oc && oc->dpms_state != DPMS_IGNORE) { + if (oc) { switch (oc->dpms_state) { case DPMS_ON: wlr_log(WLR_DEBUG, "Turning on screen"); @@ -292,17 +301,6 @@ void apply_output_config_to_outputs(struct output_config *oc) { char *name = sway_output->wlr_output->name; output_get_identifier(id, sizeof(id), sway_output); if (wildcard || !strcmp(name, oc->name) || !strcmp(id, oc->name)) { - if (!sway_output->enabled) { - if (!oc->enabled) { - if (!wildcard) { - break; - } - continue; - } - - output_enable(sway_output, oc); - } - struct output_config *current = oc; if (wildcard) { struct output_config *tmp = get_output_config(name, id); diff --git a/sway/tree/output.c b/sway/tree/output.c index 35589032..201e767f 100644 --- a/sway/tree/output.c +++ b/sway/tree/output.c @@ -54,12 +54,6 @@ struct sway_output *output_create(struct wlr_output *wlr_output) { wl_list_insert(&root->all_outputs, &output->link); - if (!wl_list_empty(&wlr_output->modes)) { - struct wlr_output_mode *mode = - wl_container_of(wlr_output->modes.prev, mode, link); - wlr_output_set_mode(wlr_output, mode); - } - output->workspaces = create_list(); output->current.workspaces = create_list();