diff options
author | Drew DeVault <[email protected]> | 2019-01-29 13:38:56 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2019-01-29 13:38:56 -0500 |
commit | 4f4424f66caa527869acf79a5e64d31a6212378f (patch) | |
tree | 9c30e11d281adaa634231f91eed98a84860ded1b /sway/config.c | |
parent | f49ad5977ea390078e8d4d6b633f895bfa0909c4 (diff) | |
parent | f0fd6119cffd22c1bdf5553cc2a729839840d63e (diff) |
Merge pull request #3535 from RedSoxFan/cleanup-log-on-config-failure
Cleanup config reading failure error logs
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 @@ #include "sway/commands.h" #include "sway/config.h" #include "sway/criteria.h" +#include "sway/desktop/transaction.h" #include "sway/swaynag.h" #include "sway/tree/arrange.h" #include "sway/tree/root.h" @@ -343,6 +344,7 @@ static bool load_config(const char *path, struct sway_config *config, struct stat sb; if (stat(path, &sb) == 0 && S_ISDIR(sb.st_mode)) { + sway_log(SWAY_ERROR, "%s is a directory not a config file", path); return false; } @@ -573,6 +575,29 @@ bool load_include_configs(const char *path, struct sway_config *config, return true; } +void run_deferred_commands(void) { + if (!config->cmd_queue->length) { + return; + } + sway_log(SWAY_DEBUG, "Running deferred commands"); + while (config->cmd_queue->length) { + char *line = config->cmd_queue->items[0]; + list_t *res_list = execute_command(line, NULL, NULL); + for (int i = 0; i < res_list->length; ++i) { + struct cmd_results *res = res_list->items[i]; + if (res->status != CMD_SUCCESS) { + sway_log(SWAY_ERROR, "Error on line '%s': %s", + line, res->error); + } + free_cmd_results(res); + } + list_del(config->cmd_queue, 0); + list_free(res_list); + free(line); + } + transaction_commit_dirty(); +} + // get line, with backslash continuation static ssize_t getline_with_cont(char **lineptr, size_t *line_size, FILE *file, int *nlines) { |