diff options
author | emersion <contact@emersion.fr> | 2018-06-07 19:26:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-07 19:26:55 +0100 |
commit | 2e289831ee3198f36e2c02bd4542fa4f6646a81b (patch) | |
tree | 7de104885aabb49f17739d7631ef6cd4f628e64a /sway/commands | |
parent | 22c1c4beb4baa369f883fb5360c40158513c8e10 (diff) | |
parent | e072fbc6d98784e5610aa88251a15f64e30bbcae (diff) |
Merge pull request #2108 from RedSoxFan/store-outputs
Allow outputs to be re-enabled
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/output.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/sway/commands/output.c b/sway/commands/output.c index bc12310e..f955bf90 100644 --- a/sway/commands/output.c +++ b/sway/commands/output.c @@ -1,5 +1,7 @@ #include "sway/commands.h" #include "sway/config.h" +#include "sway/output.h" +#include "sway/tree/layout.h" #include "list.h" #include "log.h" @@ -80,16 +82,24 @@ struct cmd_results *cmd_output(int argc, char **argv) { // will be applied during normal "new output" event from wlroots. char identifier[128]; bool all = strcmp(output->name, "*") == 0; - for (int i = 0; i < root_container.children->length; ++i) { - struct sway_container *cont = root_container.children->items[i]; - if (cont->type != C_OUTPUT) { - continue; - } + struct sway_output *sway_output; + wl_list_for_each(sway_output, &root_container.sway_root->outputs, link) { + output_get_identifier(identifier, sizeof(identifier), sway_output); + wlr_log(L_DEBUG, "Checking identifier %s", identifier); + if (all || strcmp(sway_output->wlr_output->name, output->name) == 0 + || strcmp(identifier, output->name) == 0) { + if (!sway_output->swayc) { + if (!output->enabled) { + if (!all) { + break; + } + continue; + } + + output_enable(sway_output); + } - output_get_identifier(identifier, sizeof(identifier), cont->sway_output); - if (all || strcmp(cont->name, output->name) == 0 || - strcmp(identifier, output->name) == 0) { - apply_output_config(output, cont); + apply_output_config(output, sway_output->swayc); if (!all) { // Stop looking if the output config isn't applicable to all |