diff options
author | S. Christoffer Eliesen <christoffer@eliesen.no> | 2015-11-16 11:40:24 +0100 |
---|---|---|
committer | S. Christoffer Eliesen <christoffer@eliesen.no> | 2015-11-16 15:57:42 +0100 |
commit | a94a91a723d87b37d5e24e352f83a051144a3ecf (patch) | |
tree | 8b4aa0be0fdfa0a18503671a1ce7220ae5b05d3f /sway/commands.c | |
parent | 00a4591b39182fe57c86e72f06f78fb61475f952 (diff) |
cmd_output: Replace existing config if called multiple times.
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c index 2cfda07c..f194681e 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -733,6 +733,15 @@ static struct cmd_results *cmd_output(int argc, char **argv) { } } + for (i = 0; i < config->output_configs->length; ++i) { + struct output_config *oc = config->output_configs->items[i]; + if (strcmp(oc->name, output->name) == 0) { + // replace existing config + list_del(config->output_configs, i); + free_output_config(oc); + break; + } + } list_add(config->output_configs, output); sway_log(L_DEBUG, "Config stored for output %s (%d x %d @ %d, %d)", |