aboutsummaryrefslogtreecommitdiff
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 26fa771e..e251f167 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -55,6 +55,7 @@ static sway_cmd cmd_font;
static sway_cmd cmd_for_window;
static sway_cmd cmd_fullscreen;
static sway_cmd cmd_gaps;
+static sway_cmd cmd_include;
static sway_cmd cmd_input;
static sway_cmd cmd_kill;
static sway_cmd cmd_layout;
@@ -1141,6 +1142,19 @@ static struct cmd_results *input_cmd_tap(int argc, char **argv) {
return cmd_results_new(CMD_SUCCESS, NULL, NULL);
}
+static struct cmd_results *cmd_include(int argc, char **argv) {
+ struct cmd_results *error = NULL;
+ if ((error = checkarg(argc, "include", EXPECTED_EQUAL_TO, 1))) {
+ 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]);
+ }
+
+ return cmd_results_new(CMD_SUCCESS, NULL, NULL);
+}
+
static struct cmd_results *cmd_input(int argc, char **argv) {
struct cmd_results *error = NULL;
if ((error = checkarg(argc, "input", EXPECTED_AT_LEAST, 2))) {
@@ -1541,7 +1555,9 @@ static struct cmd_results *cmd_reload(int argc, char **argv) {
if ((error = checkarg(argc, "reload", EXPECTED_EQUAL_TO, 0))) {
return error;
}
- if (!load_config(NULL)) return cmd_results_new(CMD_FAILURE, "reload", "Error(s) reloading config.");
+ if (!load_main_config(config->current_config, true)) {
+ return cmd_results_new(CMD_FAILURE, "reload", "Error(s) reloading config.");
+ }
load_swaybars();
@@ -2053,6 +2069,7 @@ static struct cmd_handler handlers[] = {
{ "for_window", cmd_for_window },
{ "fullscreen", cmd_fullscreen },
{ "gaps", cmd_gaps },
+ { "include", cmd_include },
{ "input", cmd_input },
{ "kill", cmd_kill },
{ "layout", cmd_layout },