aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/commands.c1
-rw-r--r--sway/commands/reload.c21
-rw-r--r--sway/config.c4
-rw-r--r--sway/meson.build1
4 files changed, 27 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c
index a77ff791..d4262c08 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -136,6 +136,7 @@ static struct cmd_handler handlers[] = {
136 { "input", cmd_input }, 136 { "input", cmd_input },
137 { "kill", cmd_kill }, 137 { "kill", cmd_kill },
138 { "output", cmd_output }, 138 { "output", cmd_output },
139 { "reload", cmd_reload },
139 { "seat", cmd_seat }, 140 { "seat", cmd_seat },
140 { "set", cmd_set }, 141 { "set", cmd_set },
141}; 142};
diff --git a/sway/commands/reload.c b/sway/commands/reload.c
new file mode 100644
index 00000000..2b553845
--- /dev/null
+++ b/sway/commands/reload.c
@@ -0,0 +1,21 @@
1#include "sway/commands.h"
2#include "sway/config.h"
3#include "sway/layout.h"
4
5struct cmd_results *cmd_reload(int argc, char **argv) {
6 struct cmd_results *error = NULL;
7 if (config->reading) {
8 return cmd_results_new(CMD_FAILURE, "reload", "Can't be used in config file.");
9 }
10 if ((error = checkarg(argc, "reload", EXPECTED_EQUAL_TO, 0))) {
11 return error;
12 }
13 if (!load_main_config(config->current_config, true)) {
14 return cmd_results_new(CMD_FAILURE, "reload", "Error(s) reloading config.");
15 }
16
17 load_swaybars();
18
19 arrange_windows(&root_container, -1, -1);
20 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
21}
diff --git a/sway/config.c b/sway/config.c
index 1fd123b7..cb22f664 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -698,3 +698,7 @@ char *do_var_replacement(char *str) {
698 } 698 }
699 return str; 699 return str;
700} 700}
701
702void load_swaybars() {
703 /* stub function for reload commnd, to fill when we restore swaybars */
704}
diff --git a/sway/meson.build b/sway/meson.build
index 80ccc01d..51e9e4db 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -34,6 +34,7 @@ sway_sources = files(
34 'commands/input/xkb_rules.c', 34 'commands/input/xkb_rules.c',
35 'commands/input/xkb_variant.c', 35 'commands/input/xkb_variant.c',
36 'commands/output.c', 36 'commands/output.c',
37 'commands/reload.c',
37 'config.c', 38 'config.c',
38 'config/output.c', 39 'config/output.c',
39 'config/seat.c', 40 'config/seat.c',