diff options
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/exit.c | 3 | ||||
-rw-r--r-- | sway/commands/focus.c | 14 | ||||
-rw-r--r-- | sway/commands/kill.c | 8 | ||||
-rw-r--r-- | sway/commands/layout.c | 9 | ||||
-rw-r--r-- | sway/commands/reload.c | 3 |
5 files changed, 0 insertions, 37 deletions
diff --git a/sway/commands/exit.c b/sway/commands/exit.c index 4bb6a97b..d5353c20 100644 --- a/sway/commands/exit.c +++ b/sway/commands/exit.c | |||
@@ -6,9 +6,6 @@ void sway_terminate(int exit_code); | |||
6 | 6 | ||
7 | struct cmd_results *cmd_exit(int argc, char **argv) { | 7 | struct cmd_results *cmd_exit(int argc, char **argv) { |
8 | struct cmd_results *error = NULL; | 8 | struct cmd_results *error = NULL; |
9 | if (config->reading) { | ||
10 | return cmd_results_new(CMD_FAILURE, "exit", "Can't be used in config file."); | ||
11 | } | ||
12 | if ((error = checkarg(argc, "exit", EXPECTED_EQUAL_TO, 0))) { | 9 | if ((error = checkarg(argc, "exit", EXPECTED_EQUAL_TO, 0))) { |
13 | return error; | 10 | return error; |
14 | } | 11 | } |
diff --git a/sway/commands/focus.c b/sway/commands/focus.c index ba47d1e1..f1a8078f 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c | |||
@@ -33,20 +33,6 @@ static bool parse_movement_direction(const char *name, enum movement_direction * | |||
33 | struct cmd_results *cmd_focus(int argc, char **argv) { | 33 | struct cmd_results *cmd_focus(int argc, char **argv) { |
34 | swayc_t *con = config->handler_context.current_container; | 34 | swayc_t *con = config->handler_context.current_container; |
35 | struct sway_seat *seat = config->handler_context.seat; | 35 | struct sway_seat *seat = config->handler_context.seat; |
36 | |||
37 | if (!sway_assert(seat, "'focus' command called without seat context")) { | ||
38 | return cmd_results_new(CMD_FAILURE, "focus", | ||
39 | "Command 'focus' called without seat context (this is a bug in sway)"); | ||
40 | } | ||
41 | |||
42 | if (config->reading) { | ||
43 | return cmd_results_new(CMD_FAILURE, "focus", | ||
44 | "Command 'focus' cannot be used in the config file"); | ||
45 | } | ||
46 | if (con == NULL) { | ||
47 | wlr_log(L_DEBUG, "no container to focus"); | ||
48 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
49 | } | ||
50 | if (con->type < C_WORKSPACE) { | 36 | if (con->type < C_WORKSPACE) { |
51 | return cmd_results_new(CMD_FAILURE, "focus", | 37 | return cmd_results_new(CMD_FAILURE, "focus", |
52 | "Command 'focus' cannot be used above the workspace level"); | 38 | "Command 'focus' cannot be used above the workspace level"); |
diff --git a/sway/commands/kill.c b/sway/commands/kill.c index 4b3666be..f408ce2a 100644 --- a/sway/commands/kill.c +++ b/sway/commands/kill.c | |||
@@ -6,14 +6,6 @@ | |||
6 | #include "sway/commands.h" | 6 | #include "sway/commands.h" |
7 | 7 | ||
8 | struct cmd_results *cmd_kill(int argc, char **argv) { | 8 | struct cmd_results *cmd_kill(int argc, char **argv) { |
9 | if (config->reading) { | ||
10 | return cmd_results_new(CMD_FAILURE, "kill", | ||
11 | "Command 'kill' cannot be used in the config file"); | ||
12 | } | ||
13 | if (config->handler_context.current_container == NULL) { | ||
14 | wlr_log(L_DEBUG, "no container to kill"); | ||
15 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
16 | } | ||
17 | enum swayc_types type = config->handler_context.current_container->type; | 9 | enum swayc_types type = config->handler_context.current_container->type; |
18 | if (type != C_VIEW && type != C_CONTAINER) { | 10 | if (type != C_VIEW && type != C_CONTAINER) { |
19 | return cmd_results_new(CMD_INVALID, NULL, | 11 | return cmd_results_new(CMD_INVALID, NULL, |
diff --git a/sway/commands/layout.c b/sway/commands/layout.c index d953abc8..b0fc5d66 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c | |||
@@ -7,19 +7,10 @@ | |||
7 | 7 | ||
8 | struct cmd_results *cmd_layout(int argc, char **argv) { | 8 | struct cmd_results *cmd_layout(int argc, char **argv) { |
9 | struct cmd_results *error = NULL; | 9 | struct cmd_results *error = NULL; |
10 | if (config->reading) { | ||
11 | return cmd_results_new(CMD_FAILURE, "layout", "Can't be used in config file."); | ||
12 | } | ||
13 | if (!config->active) { | ||
14 | return cmd_results_new(CMD_FAILURE, "layout", "Can only be used when sway is running."); | ||
15 | } | ||
16 | if ((error = checkarg(argc, "layout", EXPECTED_MORE_THAN, 0))) { | 10 | if ((error = checkarg(argc, "layout", EXPECTED_MORE_THAN, 0))) { |
17 | return error; | 11 | return error; |
18 | } | 12 | } |
19 | swayc_t *parent = config->handler_context.current_container; | 13 | swayc_t *parent = config->handler_context.current_container; |
20 | if (!sway_assert(parent != NULL, "command called without container context")) { | ||
21 | return NULL; | ||
22 | } | ||
23 | 14 | ||
24 | // TODO: floating | 15 | // TODO: floating |
25 | /* | 16 | /* |
diff --git a/sway/commands/reload.c b/sway/commands/reload.c index 419c7de3..d54d40db 100644 --- a/sway/commands/reload.c +++ b/sway/commands/reload.c | |||
@@ -4,9 +4,6 @@ | |||
4 | 4 | ||
5 | struct cmd_results *cmd_reload(int argc, char **argv) { | 5 | struct cmd_results *cmd_reload(int argc, char **argv) { |
6 | struct cmd_results *error = NULL; | 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))) { | 7 | if ((error = checkarg(argc, "reload", EXPECTED_EQUAL_TO, 0))) { |
11 | return error; | 8 | return error; |
12 | } | 9 | } |