diff options
author | Drew DeVault <[email protected]> | 2015-09-04 20:29:28 -0400 |
---|---|---|
committer | Drew DeVault <[email protected]> | 2015-09-04 20:29:28 -0400 |
commit | c2cd56c939098d601c9602807f8f54deb9dee2cf (patch) | |
tree | ea60cef6ce17693128669c277d6e8b8ca9cb271b /sway/config.c | |
parent | a693f671070a96f9a17c61aed6d1f95dd7b957de (diff) | |
parent | 2ef83664f528b45f8e9b3b0dbd8b8e2e0ec938bf (diff) |
Merge pull request #169 from taiyu-len/master
handling of commands during config
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/sway/config.c b/sway/config.c index 2d7e241d..90f6529a 100644 --- a/sway/config.c +++ b/sway/config.c @@ -218,18 +218,22 @@ bool read_config(FILE *file, bool is_active) { // Any command which would require wlc to be initialized // should be queued for later execution list_t *args = split_string(line, " "); - if (!is_active && ( - strcmp("exec", args->items[0]) == 0 || - strcmp("exec_always", args->items[0]) == 0 )) { - sway_log(L_DEBUG, "Deferring command %s", line); - - char *cmd = malloc(strlen(line) + 1); - strcpy(cmd, line); - list_add(temp_config->cmd_queue, cmd); - } else if (!temp_depth && !handle_command(temp_config, line)) { - sway_log(L_DEBUG, "Config load failed for line %s", line); - success = false; - temp_config->failed = true; + struct cmd_handler *handler; + if ((handler = find_handler(args->items[0]))) { + if (handler->config_type == CMD_KEYBIND) { + sway_log(L_ERROR, "Invalid command during config ``%s''", line); + } else if (handler->config_type == CMD_COMPOSITOR_READY && !is_active) { + sway_log(L_DEBUG, "Deferring command ``%s''", line); + char *cmd = malloc(strlen(line) + 1); + strcpy(cmd, line); + list_add(temp_config->cmd_queue, cmd); + } else if (!temp_depth && !handle_command(temp_config, line)) { + sway_log(L_DEBUG, "Config load failed for line ``%s''", line); + success = false; + temp_config->failed = true; + } + } else { + sway_log(L_ERROR, "Invalid command ``%s''", line); } free_flat_list(args); |