From 68beabda0382e63d2c0101d78893eb20967dbe43 Mon Sep 17 00:00:00 2001 From: Luminarys Date: Mon, 10 Aug 2015 14:00:10 -0500 Subject: [PATCH] Style fixes and slight reload command alteration --- sway/commands.c | 8 ++++---- sway/config.c | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sway/commands.c b/sway/commands.c index df394901e..5ed5e0700 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -80,7 +80,7 @@ int cmd_exec(struct sway_config *config, int argc, char **argv) { } if (config->reloading) { - sway_log(L_DEBUG, "Ignoring exec %s due to reload", join_args(argv, argc)); + sway_log(L_DEBUG, "Ignoring exec %s due to reload", join_args(argv, argc)); return 0; } @@ -176,7 +176,7 @@ int cmd_layout(struct sway_config *config, int argc, char **argv) { int cmd_reload(struct sway_config *config, int argc, char **argv) { if (argc != 0) { - sway_log(L_ERROR, "Invalid reload command (expected 1 arguments, got %d)", argc); + sway_log(L_ERROR, "Invalid reload command (expected 0 arguments, got %d)", argc); return 1; } @@ -188,9 +188,9 @@ int cmd_reload(struct sway_config *config, int argc, char **argv) { strcat(temp, name); FILE *f = fopen(temp, "r"); if (!f) { - fprintf(stderr, "Unable to open %s for reading", temp); + sway_log(L_ERROR, "Sway config file not found, aborting reload!"); free(temp); - exit(1); + return 1; } free(temp); config = read_config(f, true); diff --git a/sway/config.c b/sway/config.c index ee6c324c0..da4fac84a 100644 --- a/sway/config.c +++ b/sway/config.c @@ -18,7 +18,7 @@ void config_defaults(struct sway_config *config) { // Flags config->focus_follows_mouse = true; config->mouse_warping = true; - config->reloading = false; + config->reloading = false; } struct sway_config *read_config(FILE *file, bool is_active) { @@ -26,7 +26,7 @@ struct sway_config *read_config(FILE *file, bool is_active) { config_defaults(config); if (is_active) { - config->reloading = true; + config->reloading = true; } bool success = true; @@ -49,7 +49,7 @@ struct sway_config *read_config(FILE *file, bool is_active) { if (!temp_depth && handle_command(config, line) != 0) { success = false; } - + _continue: if (line && line[strlen(line) - 1] == '{') { temp_depth++; @@ -61,7 +61,9 @@ _continue: exit(1); } - config->reloading = false; + if (is_active) { + config->reloading = true; + } return config; }