diff options
author | Geoffrey Casper <gcasper42@gmail.com> | 2020-07-04 12:28:19 -0400 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2020-07-07 17:15:57 -0400 |
commit | ea3ba203cc65671d9bf9da5ddbc698b18ed7685c (patch) | |
tree | 22ab793cfe435091addd12ba0a940a3975451a14 | |
parent | seat/dnd: support null drag icon surfaces (diff) | |
download | sway-ea3ba203cc65671d9bf9da5ddbc698b18ed7685c.tar.gz sway-ea3ba203cc65671d9bf9da5ddbc698b18ed7685c.tar.zst sway-ea3ba203cc65671d9bf9da5ddbc698b18ed7685c.zip |
Reload command now matches i3's implementation
-rw-r--r-- | include/sway/config.h | 1 | ||||
-rw-r--r-- | sway/commands/reload.c | 14 | ||||
-rw-r--r-- | sway/config.c | 1 | ||||
-rw-r--r-- | sway/sway.5.scd | 4 |
4 files changed, 17 insertions, 3 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index b3fd6668..5ad240d3 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -500,6 +500,7 @@ struct sway_config { | |||
500 | struct side_gaps gaps_outer; | 500 | struct side_gaps gaps_outer; |
501 | 501 | ||
502 | list_t *config_chain; | 502 | list_t *config_chain; |
503 | bool user_config_path; | ||
503 | const char *current_config_path; | 504 | const char *current_config_path; |
504 | const char *current_config; | 505 | const char *current_config; |
505 | int current_config_line_number; | 506 | int current_config_line_number; |
diff --git a/sway/commands/reload.c b/sway/commands/reload.c index 19ec065c..3c994d54 100644 --- a/sway/commands/reload.c +++ b/sway/commands/reload.c | |||
@@ -22,7 +22,12 @@ static void do_reload(void *data) { | |||
22 | list_add(bar_ids, strdup(bar->id)); | 22 | list_add(bar_ids, strdup(bar->id)); |
23 | } | 23 | } |
24 | 24 | ||
25 | if (!load_main_config(config->current_config_path, true, false)) { | 25 | const char *path = NULL; |
26 | if (config->user_config_path) { | ||
27 | path = config->current_config_path; | ||
28 | } | ||
29 | |||
30 | if (!load_main_config(path, true, false)) { | ||
26 | sway_log(SWAY_ERROR, "Error(s) reloading config"); | 31 | sway_log(SWAY_ERROR, "Error(s) reloading config"); |
27 | list_free_items_and_destroy(bar_ids); | 32 | list_free_items_and_destroy(bar_ids); |
28 | return; | 33 | return; |
@@ -55,7 +60,12 @@ struct cmd_results *cmd_reload(int argc, char **argv) { | |||
55 | return error; | 60 | return error; |
56 | } | 61 | } |
57 | 62 | ||
58 | if (!load_main_config(config->current_config_path, true, true)) { | 63 | const char *path = NULL; |
64 | if (config->user_config_path) { | ||
65 | path = config->current_config_path; | ||
66 | } | ||
67 | |||
68 | if (!load_main_config(path, true, true)) { | ||
59 | return cmd_results_new(CMD_FAILURE, "Error(s) reloading config."); | 69 | return cmd_results_new(CMD_FAILURE, "Error(s) reloading config."); |
60 | } | 70 | } |
61 | 71 | ||
diff --git a/sway/config.c b/sway/config.c index bcf8d56f..71382b86 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -447,6 +447,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { | |||
447 | } | 447 | } |
448 | } | 448 | } |
449 | 449 | ||
450 | config->user_config_path = file ? true : false; | ||
450 | config->current_config_path = path; | 451 | config->current_config_path = path; |
451 | list_add(config->config_chain, real_path); | 452 | list_add(config->config_chain, real_path); |
452 | 453 | ||
diff --git a/sway/sway.5.scd b/sway/sway.5.scd index f4323f65..fed4c3c7 100644 --- a/sway/sway.5.scd +++ b/sway/sway.5.scd | |||
@@ -272,7 +272,9 @@ set|plus|minus <amount> | |||
272 | optional comment argument is ignored, but logged for debugging purposes. | 272 | optional comment argument is ignored, but logged for debugging purposes. |
273 | 273 | ||
274 | *reload* | 274 | *reload* |
275 | Reloads the sway config file and applies any changes. | 275 | Reloads the sway config file and applies any changes. The config file is |
276 | located at path specified by the command line arguments when started, | ||
277 | otherwise according to the priority stated in *sway*(1). | ||
276 | 278 | ||
277 | *rename workspace* [<old_name>] to <new_name> | 279 | *rename workspace* [<old_name>] to <new_name> |
278 | Rename either <old_name> or the focused workspace to the <new_name> | 280 | Rename either <old_name> or the focused workspace to the <new_name> |