diff options
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sway/commands.c b/sway/commands.c index d6ee4553..307196a3 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -719,7 +719,7 @@ static struct cmd_results *cmd_output(int argc, char **argv) { struct output_config *output = calloc(1, sizeof(struct output_config)); output->x = output->y = output->width = output->height = -1; output->name = strdup(name); - output->enabled = true; + output->enabled = -1; // TODO: atoi doesn't handle invalid numbers @@ -728,7 +728,7 @@ static struct cmd_results *cmd_output(int argc, char **argv) { const char *command = argv[i]; if (strcasecmp(command, "disable") == 0) { - output->enabled = false; + output->enabled = 0; } else if (strcasecmp(command, "resolution") == 0 || strcasecmp(command, "res") == 0) { if (++i >= argc) { return cmd_results_new(CMD_INVALID, "output", "Missing resolution argument."); @@ -815,15 +815,17 @@ static struct cmd_results *cmd_output(int argc, char **argv) { i = list_seq_find(config->output_configs, output_name_cmp, name); if (i >= 0) { - // replace existing config + // merge existing config struct output_config *oc = config->output_configs->items[i]; - list_del(config->output_configs, i); - free_output_config(oc); + merge_output_config(oc, output); + free_output_config(output); + output = oc; + } else { + list_add(config->output_configs, output); } - list_add(config->output_configs, output); - sway_log(L_DEBUG, "Config stored for output %s (%s) (%d x %d @ %d, %d) (bg %s %s)", - output->name, output->enabled ? "enable" : "disable", output->width, + sway_log(L_DEBUG, "Config stored for output %s (enabled:%d) (%d x %d @ %d, %d) (bg %s %s)", + output->name, output->enabled, output->width, output->height, output->x, output->y, output->background, output->background_option); |