diff options
Diffstat (limited to 'sway/commands/workspace.c')
-rw-r--r-- | sway/commands/workspace.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c index 211b344d..6bfca506 100644 --- a/sway/commands/workspace.c +++ b/sway/commands/workspace.c | |||
@@ -58,7 +58,7 @@ static void prevent_invalid_outer_gaps(struct workspace_config *wsc) { | |||
58 | 58 | ||
59 | static struct cmd_results *cmd_workspace_gaps(int argc, char **argv, | 59 | static struct cmd_results *cmd_workspace_gaps(int argc, char **argv, |
60 | int gaps_location) { | 60 | int gaps_location) { |
61 | const char *expected = "Expected 'workspace <name> gaps " | 61 | const char expected[] = "Expected 'workspace <name> gaps " |
62 | "inner|outer|horizontal|vertical|top|right|bottom|left <px>'"; | 62 | "inner|outer|horizontal|vertical|top|right|bottom|left <px>'"; |
63 | struct cmd_results *error = NULL; | 63 | struct cmd_results *error = NULL; |
64 | if ((error = checkarg(argc, "workspace", EXPECTED_EQUAL_TO, | 64 | if ((error = checkarg(argc, "workspace", EXPECTED_EQUAL_TO, |
@@ -69,7 +69,7 @@ static struct cmd_results *cmd_workspace_gaps(int argc, char **argv, | |||
69 | struct workspace_config *wsc = workspace_config_find_or_create(ws_name); | 69 | struct workspace_config *wsc = workspace_config_find_or_create(ws_name); |
70 | free(ws_name); | 70 | free(ws_name); |
71 | if (!wsc) { | 71 | if (!wsc) { |
72 | return cmd_results_new(CMD_FAILURE, "workspace gaps", | 72 | return cmd_results_new(CMD_FAILURE, |
73 | "Unable to allocate workspace output"); | 73 | "Unable to allocate workspace output"); |
74 | } | 74 | } |
75 | 75 | ||
@@ -77,7 +77,7 @@ static struct cmd_results *cmd_workspace_gaps(int argc, char **argv, | |||
77 | int amount = strtol(argv[gaps_location + 2], &end, 10); | 77 | int amount = strtol(argv[gaps_location + 2], &end, 10); |
78 | if (strlen(end)) { | 78 | if (strlen(end)) { |
79 | free(end); | 79 | free(end); |
80 | return cmd_results_new(CMD_FAILURE, "workspace gaps", expected); | 80 | return cmd_results_new(CMD_FAILURE, expected); |
81 | } | 81 | } |
82 | 82 | ||
83 | bool valid = false; | 83 | bool valid = false; |
@@ -108,7 +108,7 @@ static struct cmd_results *cmd_workspace_gaps(int argc, char **argv, | |||
108 | } | 108 | } |
109 | } | 109 | } |
110 | if (!valid) { | 110 | if (!valid) { |
111 | return cmd_results_new(CMD_INVALID, "workspace gaps", expected); | 111 | return cmd_results_new(CMD_INVALID, expected); |
112 | } | 112 | } |
113 | 113 | ||
114 | // Prevent invalid gaps configurations. | 114 | // Prevent invalid gaps configurations. |
@@ -150,7 +150,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
150 | struct workspace_config *wsc = workspace_config_find_or_create(ws_name); | 150 | struct workspace_config *wsc = workspace_config_find_or_create(ws_name); |
151 | free(ws_name); | 151 | free(ws_name); |
152 | if (!wsc) { | 152 | if (!wsc) { |
153 | return cmd_results_new(CMD_FAILURE, "workspace output", | 153 | return cmd_results_new(CMD_FAILURE, |
154 | "Unable to allocate workspace output"); | 154 | "Unable to allocate workspace output"); |
155 | } | 155 | } |
156 | for (int i = output_location + 1; i < argc; ++i) { | 156 | for (int i = output_location + 1; i < argc; ++i) { |
@@ -162,9 +162,9 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
162 | } | 162 | } |
163 | } else { | 163 | } else { |
164 | if (config->reading || !config->active) { | 164 | if (config->reading || !config->active) { |
165 | return cmd_results_new(CMD_DEFER, "workspace", NULL); | 165 | return cmd_results_new(CMD_DEFER, NULL); |
166 | } else if (!root->outputs->length) { | 166 | } else if (!root->outputs->length) { |
167 | return cmd_results_new(CMD_INVALID, "workspace", | 167 | return cmd_results_new(CMD_INVALID, |
168 | "Can't run this command while there's no outputs connected."); | 168 | "Can't run this command while there's no outputs connected."); |
169 | } | 169 | } |
170 | 170 | ||
@@ -181,11 +181,11 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
181 | struct sway_workspace *ws = NULL; | 181 | struct sway_workspace *ws = NULL; |
182 | if (strcasecmp(argv[0], "number") == 0) { | 182 | if (strcasecmp(argv[0], "number") == 0) { |
183 | if (argc < 2) { | 183 | if (argc < 2) { |
184 | return cmd_results_new(CMD_INVALID, "workspace", | 184 | return cmd_results_new(CMD_INVALID, |
185 | "Expected workspace number"); | 185 | "Expected workspace number"); |
186 | } | 186 | } |
187 | if (!isdigit(argv[1][0])) { | 187 | if (!isdigit(argv[1][0])) { |
188 | return cmd_results_new(CMD_INVALID, "workspace", | 188 | return cmd_results_new(CMD_INVALID, |
189 | "Invalid workspace number '%s'", argv[1]); | 189 | "Invalid workspace number '%s'", argv[1]); |
190 | } | 190 | } |
191 | if (!(ws = workspace_by_number(argv[1]))) { | 191 | if (!(ws = workspace_by_number(argv[1]))) { |
@@ -202,7 +202,7 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
202 | } else if (strcasecmp(argv[0], "back_and_forth") == 0) { | 202 | } else if (strcasecmp(argv[0], "back_and_forth") == 0) { |
203 | struct sway_seat *seat = config->handler_context.seat; | 203 | struct sway_seat *seat = config->handler_context.seat; |
204 | if (!seat->prev_workspace_name) { | 204 | if (!seat->prev_workspace_name) { |
205 | return cmd_results_new(CMD_INVALID, "workspace", | 205 | return cmd_results_new(CMD_INVALID, |
206 | "There is no previous workspace"); | 206 | "There is no previous workspace"); |
207 | } | 207 | } |
208 | if (!(ws = workspace_by_name(argv[0]))) { | 208 | if (!(ws = workspace_by_name(argv[0]))) { |
@@ -218,5 +218,5 @@ struct cmd_results *cmd_workspace(int argc, char **argv) { | |||
218 | workspace_switch(ws, no_auto_back_and_forth); | 218 | workspace_switch(ws, no_auto_back_and_forth); |
219 | seat_consider_warp_to_focus(config->handler_context.seat); | 219 | seat_consider_warp_to_focus(config->handler_context.seat); |
220 | } | 220 | } |
221 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 221 | return cmd_results_new(CMD_SUCCESS, NULL); |
222 | } | 222 | } |