aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/reload.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-08-02 21:37:29 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-08-03 10:37:35 -0400
commita7f7d4a488c8d3b2461122765f9904c8a411a583 (patch)
tree7abee51265a8b9550c62255d0c6649935ee1d6a2 /sway/commands/reload.c
parentShow swaynag on config errors (diff)
downloadsway-a7f7d4a488c8d3b2461122765f9904c8a411a583.tar.gz
sway-a7f7d4a488c8d3b2461122765f9904c8a411a583.tar.zst
sway-a7f7d4a488c8d3b2461122765f9904c8a411a583.zip
Write to swaynag pipe fd directly on config errors
Diffstat (limited to 'sway/commands/reload.c')
-rw-r--r--sway/commands/reload.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/sway/commands/reload.c b/sway/commands/reload.c
index 9bf671d9..f8ca374d 100644
--- a/sway/commands/reload.c
+++ b/sway/commands/reload.c
@@ -1,5 +1,4 @@
1#define _XOPEN_SOURCE 500 1#define _XOPEN_SOURCE 500
2#include <signal.h>
3#include <string.h> 2#include <string.h>
4#include "sway/commands.h" 3#include "sway/commands.h"
5#include "sway/config.h" 4#include "sway/config.h"
@@ -20,9 +19,7 @@ struct cmd_results *cmd_reload(int argc, char **argv) {
20 list_add(bar_ids, strdup(bar->id)); 19 list_add(bar_ids, strdup(bar->id));
21 } 20 }
22 21
23 char *errors = NULL; 22 if (!load_main_config(config->current_config_path, true, false)) {
24 if (!load_main_config(config->current_config_path, true, &errors)) {
25 free(errors);
26 return cmd_results_new(CMD_FAILURE, "reload", 23 return cmd_results_new(CMD_FAILURE, "reload",
27 "Error(s) reloading config."); 24 "Error(s) reloading config.");
28 } 25 }
@@ -47,15 +44,5 @@ struct cmd_results *cmd_reload(int argc, char **argv) {
47 44
48 arrange_windows(&root_container); 45 arrange_windows(&root_container);
49 46
50 if (config->swaynag_pid > 0) {
51 kill(config->swaynag_pid, SIGTERM);
52 config->swaynag_pid = -1;
53 }
54
55 if (errors) {
56 spawn_swaynag_config_errors(config, errors);
57 free(errors);
58 }
59
60 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 47 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
61} 48}