diff options
Diffstat (limited to 'sway/config.c')
-rw-r--r-- | sway/config.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sway/config.c b/sway/config.c index 145b3be6..7cb27d95 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "sway/commands.h" | 20 | #include "sway/commands.h" |
21 | #include "sway/config.h" | 21 | #include "sway/config.h" |
22 | #include "sway/criteria.h" | 22 | #include "sway/criteria.h" |
23 | #include "sway/desktop/transaction.h" | ||
23 | #include "sway/swaynag.h" | 24 | #include "sway/swaynag.h" |
24 | #include "sway/tree/arrange.h" | 25 | #include "sway/tree/arrange.h" |
25 | #include "sway/tree/root.h" | 26 | #include "sway/tree/root.h" |
@@ -343,6 +344,7 @@ static bool load_config(const char *path, struct sway_config *config, | |||
343 | 344 | ||
344 | struct stat sb; | 345 | struct stat sb; |
345 | if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) { | 346 | if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) { |
347 | sway_log(SWAY_ERROR, "%s is a directory not a config file", path); | ||
346 | return false; | 348 | return false; |
347 | } | 349 | } |
348 | 350 | ||
@@ -573,6 +575,29 @@ bool load_include_configs(const char *path, struct sway_config *config, | |||
573 | return true; | 575 | return true; |
574 | } | 576 | } |
575 | 577 | ||
578 | void run_deferred_commands(void) { | ||
579 | if (!config->cmd_queue->length) { | ||
580 | return; | ||
581 | } | ||
582 | sway_log(SWAY_DEBUG, "Running deferred commands"); | ||
583 | while (config->cmd_queue->length) { | ||
584 | char *line = config->cmd_queue->items[0]; | ||
585 | list_t *res_list = execute_command(line, NULL, NULL); | ||
586 | for (int i = 0; i < res_list->length; ++i) { | ||
587 | struct cmd_results *res = res_list->items[i]; | ||
588 | if (res->status != CMD_SUCCESS) { | ||
589 | sway_log(SWAY_ERROR, "Error on line '%s': %s", | ||
590 | line, res->error); | ||
591 | } | ||
592 | free_cmd_results(res); | ||
593 | } | ||
594 | list_del(config->cmd_queue, 0); | ||
595 | list_free(res_list); | ||
596 | free(line); | ||
597 | } | ||
598 | transaction_commit_dirty(); | ||
599 | } | ||
600 | |||
576 | // get line, with backslash continuation | 601 | // get line, with backslash continuation |
577 | static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file, | 602 | static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file, |
578 | int *nlines) { | 603 | int *nlines) { |