diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-08-03 15:08:38 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-03 15:08:38 -0400 |
commit | 38675eba7be471a2dacb5928f54d046297c23517 (patch) | |
tree | 7982d1f38fcb3620372c1c8461de1450063e5355 /sway/commands | |
parent | 3e2bf7f3a550db995a38808e0abd53fefab96f80 (diff) | |
parent | 36fd84cc42ebb2933d24c2d3d4b84f3f32f065b0 (diff) |
Merge pull request #2400 from RedSoxFan/swaynag-config-errors
Show swaynag on config errors
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/include.c | 6 | ||||
-rw-r--r-- | sway/commands/reload.c | 6 | ||||
-rw-r--r-- | sway/commands/swaynag_command.c | 20 |
3 files changed, 28 insertions, 4 deletions
diff --git a/sway/commands/include.c b/sway/commands/include.c index 1ba9a10d..61f383bb 100644 --- a/sway/commands/include.c +++ b/sway/commands/include.c @@ -7,8 +7,10 @@ struct cmd_results *cmd_include(int argc, char **argv) { return error; } - if (!load_include_configs(argv[0], config)) { - return cmd_results_new(CMD_INVALID, "include", "Failed to include sub configuration file: %s", argv[0]); + if (!load_include_configs(argv[0], config, + &config->swaynag_config_errors)) { + return cmd_results_new(CMD_INVALID, "include", + "Failed to include sub configuration file: %s", argv[0]); } return cmd_results_new(CMD_SUCCESS, NULL, NULL); diff --git a/sway/commands/reload.c b/sway/commands/reload.c index 5c1b19b4..f8ca374d 100644 --- a/sway/commands/reload.c +++ b/sway/commands/reload.c @@ -19,8 +19,9 @@ struct cmd_results *cmd_reload(int argc, char **argv) { list_add(bar_ids, strdup(bar->id)); } - if (!load_main_config(config->current_config_path, true)) { - return cmd_results_new(CMD_FAILURE, "reload", "Error(s) reloading config."); + if (!load_main_config(config->current_config_path, true, false)) { + return cmd_results_new(CMD_FAILURE, "reload", + "Error(s) reloading config."); } ipc_event_workspace(NULL, NULL, "reload"); @@ -42,5 +43,6 @@ struct cmd_results *cmd_reload(int argc, char **argv) { list_free(bar_ids); arrange_windows(&root_container); + return cmd_results_new(CMD_SUCCESS, NULL, NULL); } diff --git a/sway/commands/swaynag_command.c b/sway/commands/swaynag_command.c new file mode 100644 index 00000000..c57a80a6 --- /dev/null +++ b/sway/commands/swaynag_command.c @@ -0,0 +1,20 @@ +#include <string.h> +#include "sway/commands.h" +#include "log.h" +#include "stringop.h" + +struct cmd_results *cmd_swaynag_command(int argc, char **argv) { + struct cmd_results *error = NULL; + if ((error = checkarg(argc, "swaynag_command", EXPECTED_AT_LEAST, 1))) { + return error; + } + + if (config->swaynag_command) { + free(config->swaynag_command); + } + config->swaynag_command = join_args(argv, argc); + wlr_log(WLR_DEBUG, "Using custom swaynag command: %s", + config->swaynag_command); + + return cmd_results_new(CMD_SUCCESS, NULL, NULL); +} |