diff options
author | Luminarys <[email protected]> | 2015-08-13 12:32:43 -0500 |
---|---|---|
committer | Luminarys <[email protected]> | 2015-08-13 14:41:36 -0500 |
commit | ab130fb56b5c450d3821cfdfc18fc7a37487c70a (patch) | |
tree | 83ab7d27907dfa8c2a5f0d7bd740f8f49a208e50 /sway/config.c | |
parent | 2c9f5eca89ac5ab1a3eaacc3b56243978098408c (diff) |
Added in command queue
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sway/config.c b/sway/config.c index 6fe681f6..e8ff42dc 100644 --- a/sway/config.c +++ b/sway/config.c @@ -33,6 +33,7 @@ bool load_config() { void config_defaults(struct sway_config *config) { config->symbols = create_list(); config->modes = create_list(); + config->cmd_queue = create_list(); config->current_mode = malloc(sizeof(struct sway_mode)); config->current_mode->name = NULL; config->current_mode->bindings = create_list(); @@ -68,9 +69,20 @@ struct sway_config *read_config(FILE *file, bool is_active) { goto _continue; } - if (!temp_depth && handle_command(config, line) != true) { + // Any command which would require wlc to be initialized + // should be queue for later execution + list_t *args = split_string(line, " "); + sway_log(L_DEBUG, "Checking command %s", line); + if (strcmp("workspace", args->items[0]) == 0) { + sway_log(L_DEBUG, "Deferring command %s", line); + char *cmd = malloc(strlen(line) + 1); + strcpy(cmd, line); + list_add(config->cmd_queue, cmd); + }else if (!temp_depth && !handle_command(config, line)) { + sway_log(L_DEBUG, "Config load failed for line %s", line); success = false; - } + } + list_free(args); _continue: if (line && line[strlen(line) - 1] == '{') { @@ -80,6 +92,7 @@ _continue: } if (success == false) { + sway_log(L_DEBUG, "Config load failed, exiting"); exit(1); } |