diff options
Diffstat (limited to 'sway/commands/output.c')
-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 @@ | |||
1 | #include "sway/commands.h" | 1 | #include "sway/commands.h" |
2 | #include "sway/config.h" | 2 | #include "sway/config.h" |
3 | #include "sway/output.h" | ||
4 | #include "sway/tree/layout.h" | ||
3 | #include "list.h" | 5 | #include "list.h" |
4 | #include "log.h" | 6 | #include "log.h" |
5 | 7 | ||
@@ -80,16 +82,24 @@ struct cmd_results *cmd_output(int argc, char **argv) { | |||
80 | // will be applied during normal "new output" event from wlroots. | 82 | // will be applied during normal "new output" event from wlroots. |
81 | char identifier[128]; | 83 | char identifier[128]; |
82 | bool all = strcmp(output->name, "*") == 0; | 84 | bool all = strcmp(output->name, "*") == 0; |
83 | for (int i = 0; i < root_container.children->length; ++i) { | 85 | struct sway_output *sway_output; |
84 | struct sway_container *cont = root_container.children->items[i]; | 86 | wl_list_for_each(sway_output, &root_container.sway_root->outputs, link) { |
85 | if (cont->type != C_OUTPUT) { | 87 | output_get_identifier(identifier, sizeof(identifier), sway_output); |
86 | continue; | 88 | wlr_log(L_DEBUG, "Checking identifier %s", identifier); |
87 | } | 89 | if (all || strcmp(sway_output->wlr_output->name, output->name) == 0 |
90 | || strcmp(identifier, output->name) == 0) { | ||
91 | if (!sway_output->swayc) { | ||
92 | if (!output->enabled) { | ||
93 | if (!all) { | ||
94 | break; | ||
95 | } | ||
96 | continue; | ||
97 | } | ||
98 | |||
99 | output_enable(sway_output); | ||
100 | } | ||
88 | 101 | ||
89 | output_get_identifier(identifier, sizeof(identifier), cont->sway_output); | 102 | apply_output_config(output, sway_output->swayc); |
90 | if (all || strcmp(cont->name, output->name) == 0 || | ||
91 | strcmp(identifier, output->name) == 0) { | ||
92 | apply_output_config(output, cont); | ||
93 | 103 | ||
94 | if (!all) { | 104 | if (!all) { |
95 | // Stop looking if the output config isn't applicable to all | 105 | // Stop looking if the output config isn't applicable to all |