diff options
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sway/commands.c b/sway/commands.c index eb77c172..7605a36b 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -561,7 +561,6 @@ static enum cmd_status cmd_orientation(int argc, char **argv) { | |||
561 | } | 561 | } |
562 | 562 | ||
563 | static enum cmd_status cmd_output(int argc, char **argv) { | 563 | static enum cmd_status cmd_output(int argc, char **argv) { |
564 | if (!config->reading) return CMD_FAILURE; | ||
565 | if (!checkarg(argc, "output", EXPECTED_AT_LEAST, 1)) { | 564 | if (!checkarg(argc, "output", EXPECTED_AT_LEAST, 1)) { |
566 | return CMD_FAILURE; | 565 | return CMD_FAILURE; |
567 | } | 566 | } |
@@ -619,9 +618,23 @@ static enum cmd_status cmd_output(int argc, char **argv) { | |||
619 | 618 | ||
620 | list_add(config->output_configs, output); | 619 | list_add(config->output_configs, output); |
621 | 620 | ||
622 | sway_log(L_DEBUG, "Configured output %s to %d x %d @ %d, %d", | 621 | sway_log(L_DEBUG, "Config stored for output %s (%d x %d @ %d, %d)", |
623 | output->name, output->width, output->height, output->x, output->y); | 622 | output->name, output->width, output->height, output->x, output->y); |
624 | 623 | ||
624 | if (output->name) { | ||
625 | // Try to find the output container and apply configuration now. If | ||
626 | // this is during startup then there will be no container and config | ||
627 | // will be applied during normal "new output" event from wlc. | ||
628 | swayc_t *cont = NULL; | ||
629 | for (int i = 0; i < root_container.children->length; ++i) { | ||
630 | cont = root_container.children->items[i]; | ||
631 | if (cont->name && strcmp(cont->name, output->name) == 0) { | ||
632 | apply_output_config(output, cont); | ||
633 | break; | ||
634 | } | ||
635 | } | ||
636 | } | ||
637 | |||
625 | return CMD_SUCCESS; | 638 | return CMD_SUCCESS; |
626 | } | 639 | } |
627 | 640 | ||