diff options
Diffstat (limited to 'sway')
-rw-r--r-- | sway/commands/floating.c | 4 | ||||
-rw-r--r-- | sway/commands/focus.c | 4 | ||||
-rw-r--r-- | sway/commands/fullscreen.c | 4 | ||||
-rw-r--r-- | sway/commands/gaps.c | 4 | ||||
-rw-r--r-- | sway/commands/kill.c | 4 | ||||
-rw-r--r-- | sway/commands/layout.c | 4 | ||||
-rw-r--r-- | sway/commands/move.c | 4 | ||||
-rw-r--r-- | sway/commands/rename.c | 4 | ||||
-rw-r--r-- | sway/commands/resize.c | 4 | ||||
-rw-r--r-- | sway/commands/scratchpad.c | 4 | ||||
-rw-r--r-- | sway/commands/split.c | 4 | ||||
-rw-r--r-- | sway/commands/swap.c | 4 | ||||
-rw-r--r-- | sway/commands/workspace.c | 4 |
13 files changed, 52 insertions, 0 deletions
diff --git a/sway/commands/floating.c b/sway/commands/floating.c index 97662a18..81bb86f8 100644 --- a/sway/commands/floating.c +++ b/sway/commands/floating.c | |||
@@ -15,6 +15,10 @@ struct cmd_results *cmd_floating(int argc, char **argv) { | |||
15 | if ((error = checkarg(argc, "floating", EXPECTED_EQUAL_TO, 1))) { | 15 | if ((error = checkarg(argc, "floating", EXPECTED_EQUAL_TO, 1))) { |
16 | return error; | 16 | return error; |
17 | } | 17 | } |
18 | if (!root->outputs->length) { | ||
19 | return cmd_results_new(CMD_INVALID, "floating", | ||
20 | "Can't run this command while there's no outputs connected."); | ||
21 | } | ||
18 | struct sway_container *container = config->handler_context.container; | 22 | struct sway_container *container = config->handler_context.container; |
19 | struct sway_workspace *workspace = config->handler_context.workspace; | 23 | struct sway_workspace *workspace = config->handler_context.workspace; |
20 | if (!container && workspace->tiling->length == 0) { | 24 | if (!container && workspace->tiling->length == 0) { |
diff --git a/sway/commands/focus.c b/sway/commands/focus.c index b4965cf8..2204f722 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c | |||
@@ -224,6 +224,10 @@ struct cmd_results *cmd_focus(int argc, char **argv) { | |||
224 | if (config->reading || !config->active) { | 224 | if (config->reading || !config->active) { |
225 | return cmd_results_new(CMD_DEFER, NULL, NULL); | 225 | return cmd_results_new(CMD_DEFER, NULL, NULL); |
226 | } | 226 | } |
227 | if (!root->outputs->length) { | ||
228 | return cmd_results_new(CMD_INVALID, "focus", | ||
229 | "Can't run this command while there's no outputs connected."); | ||
230 | } | ||
227 | struct sway_node *node = config->handler_context.node; | 231 | struct sway_node *node = config->handler_context.node; |
228 | struct sway_container *container = config->handler_context.container; | 232 | struct sway_container *container = config->handler_context.container; |
229 | struct sway_workspace *workspace = config->handler_context.workspace; | 233 | struct sway_workspace *workspace = config->handler_context.workspace; |
diff --git a/sway/commands/fullscreen.c b/sway/commands/fullscreen.c index 0204a73c..ff7cbba7 100644 --- a/sway/commands/fullscreen.c +++ b/sway/commands/fullscreen.c | |||
@@ -12,6 +12,10 @@ struct cmd_results *cmd_fullscreen(int argc, char **argv) { | |||
12 | if ((error = checkarg(argc, "fullscreen", EXPECTED_AT_MOST, 1))) { | 12 | if ((error = checkarg(argc, "fullscreen", EXPECTED_AT_MOST, 1))) { |
13 | return error; | 13 | return error; |
14 | } | 14 | } |
15 | if (!root->outputs->length) { | ||
16 | return cmd_results_new(CMD_INVALID, "fullscreen", | ||
17 | "Can't run this command while there's no outputs connected."); | ||
18 | } | ||
15 | struct sway_node *node = config->handler_context.node; | 19 | struct sway_node *node = config->handler_context.node; |
16 | struct sway_container *container = config->handler_context.container; | 20 | struct sway_container *container = config->handler_context.container; |
17 | struct sway_workspace *workspace = config->handler_context.workspace; | 21 | struct sway_workspace *workspace = config->handler_context.workspace; |
diff --git a/sway/commands/gaps.c b/sway/commands/gaps.c index 042b415f..ca8cb27a 100644 --- a/sway/commands/gaps.c +++ b/sway/commands/gaps.c | |||
@@ -88,6 +88,10 @@ static struct cmd_results *gaps_set_runtime(int argc, char **argv) { | |||
88 | if (error) { | 88 | if (error) { |
89 | return error; | 89 | return error; |
90 | } | 90 | } |
91 | if (!root->outputs->length) { | ||
92 | return cmd_results_new(CMD_INVALID, "gaps", | ||
93 | "Can't run this command while there's no outputs connected."); | ||
94 | } | ||
91 | 95 | ||
92 | struct gaps_data data; | 96 | struct gaps_data data; |
93 | 97 | ||
diff --git a/sway/commands/kill.c b/sway/commands/kill.c index 85ca0f33..f1d75b9a 100644 --- a/sway/commands/kill.c +++ b/sway/commands/kill.c | |||
@@ -14,6 +14,10 @@ static void close_container_iterator(struct sway_container *con, void *data) { | |||
14 | } | 14 | } |
15 | 15 | ||
16 | struct cmd_results *cmd_kill(int argc, char **argv) { | 16 | struct cmd_results *cmd_kill(int argc, char **argv) { |
17 | if (!root->outputs->length) { | ||
18 | return cmd_results_new(CMD_INVALID, "kill", | ||
19 | "Can't run this command while there's no outputs connected."); | ||
20 | } | ||
17 | struct sway_container *con = config->handler_context.container; | 21 | struct sway_container *con = config->handler_context.container; |
18 | struct sway_workspace *ws = config->handler_context.workspace; | 22 | struct sway_workspace *ws = config->handler_context.workspace; |
19 | 23 | ||
diff --git a/sway/commands/layout.c b/sway/commands/layout.c index 65f67af8..8fde1776 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c | |||
@@ -99,6 +99,10 @@ struct cmd_results *cmd_layout(int argc, char **argv) { | |||
99 | if ((error = checkarg(argc, "layout", EXPECTED_AT_LEAST, 1))) { | 99 | if ((error = checkarg(argc, "layout", EXPECTED_AT_LEAST, 1))) { |
100 | return error; | 100 | return error; |
101 | } | 101 | } |
102 | if (!root->outputs->length) { | ||
103 | return cmd_results_new(CMD_INVALID, "layout", | ||
104 | "Can't run this command while there's no outputs connected."); | ||
105 | } | ||
102 | struct sway_container *container = config->handler_context.container; | 106 | struct sway_container *container = config->handler_context.container; |
103 | struct sway_workspace *workspace = config->handler_context.workspace; | 107 | struct sway_workspace *workspace = config->handler_context.workspace; |
104 | 108 | ||
diff --git a/sway/commands/move.c b/sway/commands/move.c index e0a958bf..ffe12d41 100644 --- a/sway/commands/move.c +++ b/sway/commands/move.c | |||
@@ -844,6 +844,10 @@ struct cmd_results *cmd_move(int argc, char **argv) { | |||
844 | if ((error = checkarg(argc, "move", EXPECTED_AT_LEAST, 1))) { | 844 | if ((error = checkarg(argc, "move", EXPECTED_AT_LEAST, 1))) { |
845 | return error; | 845 | return error; |
846 | } | 846 | } |
847 | if (!root->outputs->length) { | ||
848 | return cmd_results_new(CMD_INVALID, "move", | ||
849 | "Can't run this command while there's no outputs connected."); | ||
850 | } | ||
847 | 851 | ||
848 | if (strcasecmp(argv[0], "left") == 0) { | 852 | if (strcasecmp(argv[0], "left") == 0) { |
849 | return cmd_move_in_direction(MOVE_LEFT, argc, argv); | 853 | return cmd_move_in_direction(MOVE_LEFT, argc, argv); |
diff --git a/sway/commands/rename.c b/sway/commands/rename.c index d982f941..0cee9293 100644 --- a/sway/commands/rename.c +++ b/sway/commands/rename.c | |||
@@ -20,6 +20,10 @@ struct cmd_results *cmd_rename(int argc, char **argv) { | |||
20 | if ((error = checkarg(argc, "rename", EXPECTED_AT_LEAST, 3))) { | 20 | if ((error = checkarg(argc, "rename", EXPECTED_AT_LEAST, 3))) { |
21 | return error; | 21 | return error; |
22 | } | 22 | } |
23 | if (!root->outputs->length) { | ||
24 | return cmd_results_new(CMD_INVALID, "rename", | ||
25 | "Can't run this command while there's no outputs connected."); | ||
26 | } | ||
23 | if (strcasecmp(argv[0], "workspace") != 0) { | 27 | if (strcasecmp(argv[0], "workspace") != 0) { |
24 | return cmd_results_new(CMD_INVALID, "rename", expected_syntax); | 28 | return cmd_results_new(CMD_INVALID, "rename", expected_syntax); |
25 | } | 29 | } |
diff --git a/sway/commands/resize.c b/sway/commands/resize.c index 8666f40b..8635b309 100644 --- a/sway/commands/resize.c +++ b/sway/commands/resize.c | |||
@@ -671,6 +671,10 @@ static struct cmd_results *cmd_resize_adjust(int argc, char **argv, | |||
671 | } | 671 | } |
672 | 672 | ||
673 | struct cmd_results *cmd_resize(int argc, char **argv) { | 673 | struct cmd_results *cmd_resize(int argc, char **argv) { |
674 | if (!root->outputs->length) { | ||
675 | return cmd_results_new(CMD_INVALID, "resize", | ||
676 | "Can't run this command while there's no outputs connected."); | ||
677 | } | ||
674 | struct sway_container *current = config->handler_context.container; | 678 | struct sway_container *current = config->handler_context.container; |
675 | if (!current) { | 679 | if (!current) { |
676 | return cmd_results_new(CMD_INVALID, "resize", "Cannot resize nothing"); | 680 | return cmd_results_new(CMD_INVALID, "resize", "Cannot resize nothing"); |
diff --git a/sway/commands/scratchpad.c b/sway/commands/scratchpad.c index 26f0e490..6eab456d 100644 --- a/sway/commands/scratchpad.c +++ b/sway/commands/scratchpad.c | |||
@@ -87,6 +87,10 @@ struct cmd_results *cmd_scratchpad(int argc, char **argv) { | |||
87 | return cmd_results_new(CMD_INVALID, "scratchpad", | 87 | return cmd_results_new(CMD_INVALID, "scratchpad", |
88 | "Expected 'scratchpad show'"); | 88 | "Expected 'scratchpad show'"); |
89 | } | 89 | } |
90 | if (!root->outputs->length) { | ||
91 | return cmd_results_new(CMD_INVALID, "scratchpad", | ||
92 | "Can't run this command while there's no outputs connected."); | ||
93 | } | ||
90 | if (!root->scratchpad->length) { | 94 | if (!root->scratchpad->length) { |
91 | return cmd_results_new(CMD_INVALID, "scratchpad", | 95 | return cmd_results_new(CMD_INVALID, "scratchpad", |
92 | "Scratchpad is empty"); | 96 | "Scratchpad is empty"); |
diff --git a/sway/commands/split.c b/sway/commands/split.c index 9a53f3d3..ed106a86 100644 --- a/sway/commands/split.c +++ b/sway/commands/split.c | |||
@@ -28,6 +28,10 @@ struct cmd_results *cmd_split(int argc, char **argv) { | |||
28 | if ((error = checkarg(argc, "split", EXPECTED_EQUAL_TO, 1))) { | 28 | if ((error = checkarg(argc, "split", EXPECTED_EQUAL_TO, 1))) { |
29 | return error; | 29 | return error; |
30 | } | 30 | } |
31 | if (!root->outputs->length) { | ||
32 | return cmd_results_new(CMD_INVALID, "split", | ||
33 | "Can't run this command while there's no outputs connected."); | ||
34 | } | ||
31 | if (strcasecmp(argv[0], "v") == 0 || strcasecmp(argv[0], "vertical") == 0) { | 35 | if (strcasecmp(argv[0], "v") == 0 || strcasecmp(argv[0], "vertical") == 0) { |
32 | return do_split(L_VERT); | 36 | return do_split(L_VERT); |
33 | } else if (strcasecmp(argv[0], "h") == 0 || | 37 | } else if (strcasecmp(argv[0], "h") == 0 || |
diff --git a/sway/commands/swap.c b/sway/commands/swap.c index afe11a47..a70a6cdd 100644 --- a/sway/commands/swap.c +++ b/sway/commands/swap.c | |||
@@ -171,6 +171,10 @@ struct cmd_results *cmd_swap(int argc, char **argv) { | |||
171 | if ((error = checkarg(argc, "swap", EXPECTED_AT_LEAST, 4))) { | 171 | if ((error = checkarg(argc, "swap", EXPECTED_AT_LEAST, 4))) { |
172 | return error; | 172 | return error; |
173 | } | 173 | } |
174 | if (!root->outputs->length) { | ||
175 | return cmd_results_new(CMD_INVALID, "swap", | ||
176 | "Can't run this command while there's no outputs connected."); | ||
177 | } | ||
174 | 178 | ||
175 | if (strcasecmp(argv[0], "container") || strcasecmp(argv[1], "with")) { | 179 | if (strcasecmp(argv[0], "container") || strcasecmp(argv[1], "with")) { |
176 | return cmd_results_new(CMD_INVALID, "swap", EXPECTED_SYNTAX); | 180 | return cmd_results_new(CMD_INVALID, "swap", EXPECTED_SYNTAX); |
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index 745b40c7..8364e607 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c | |||
@@ -38,6 +38,10 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
38 | if ((error = checkarg(argc, "workspace", EXPECTED_AT_LEAST, 1))) { | 38 | if ((error = checkarg(argc, "workspace", EXPECTED_AT_LEAST, 1))) { |
39 | return error; | 39 | return error; |
40 | } | 40 | } |
41 | if (!root->outputs->length) { | ||
42 | return cmd_results_new(CMD_INVALID, "workspace", | ||
43 | "Can't run this command while there's no outputs connected."); | ||
44 | } | ||
41 | 45 | ||
42 | int output_location = -1; | 46 | int output_location = -1; |
43 | int gaps_location = -1; | 47 | int gaps_location = -1; |