summaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c18
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) {
719 struct output_config *output = calloc(1, sizeof(struct output_config)); 719 struct output_config *output = calloc(1, sizeof(struct output_config));
720 output->x = output->y = output->width = output->height = -1; 720 output->x = output->y = output->width = output->height = -1;
721 output->name = strdup(name); 721 output->name = strdup(name);
722 output->enabled = true; 722 output->enabled = -1;
723 723
724 // TODO: atoi doesn't handle invalid numbers 724 // TODO: atoi doesn't handle invalid numbers
725 725
@@ -728,7 +728,7 @@ static struct cmd_results *cmd_output(int argc, char **argv) {
728 const char *command = argv[i]; 728 const char *command = argv[i];
729 729
730 if (strcasecmp(command, "disable") == 0) { 730 if (strcasecmp(command, "disable") == 0) {
731 output->enabled = false; 731 output->enabled = 0;
732 } else if (strcasecmp(command, "resolution") == 0 || strcasecmp(command, "res") == 0) { 732 } else if (strcasecmp(command, "resolution") == 0 || strcasecmp(command, "res") == 0) {
733 if (++i >= argc) { 733 if (++i >= argc) {
734 return cmd_results_new(CMD_INVALID, "output", "Missing resolution argument."); 734 return cmd_results_new(CMD_INVALID, "output", "Missing resolution argument.");
@@ -815,15 +815,17 @@ static struct cmd_results *cmd_output(int argc, char **argv) {
815 815
816 i = list_seq_find(config->output_configs, output_name_cmp, name); 816 i = list_seq_find(config->output_configs, output_name_cmp, name);
817 if (i >= 0) { 817 if (i >= 0) {
818 // replace existing config 818 // merge existing config
819 struct output_config *oc = config->output_configs->items[i]; 819 struct output_config *oc = config->output_configs->items[i];
820 list_del(config->output_configs, i); 820 merge_output_config(oc, output);
821 free_output_config(oc); 821 free_output_config(output);
822 output = oc;
823 } else {
824 list_add(config->output_configs, output);
822 } 825 }
823 list_add(config->output_configs, output);
824 826
825 sway_log(L_DEBUG, "Config stored for output %s (%s) (%d x %d @ %d, %d) (bg %s %s)", 827 sway_log(L_DEBUG, "Config stored for output %s (enabled:%d) (%d x %d @ %d, %d) (bg %s %s)",
826 output->name, output->enabled ? "enable" : "disable", output->width, 828 output->name, output->enabled, output->width,
827 output->height, output->x, output->y, output->background, 829 output->height, output->x, output->y, output->background,
828 output->background_option); 830 output->background_option);
829 831