diff options
Diffstat (limited to 'sway/commands/focus.c')
-rw-r--r-- | sway/commands/focus.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/sway/commands/focus.c b/sway/commands/focus.c index 97ffe91c..8564f3ff 100644 --- a/sway/commands/focus.c +++ b/sway/commands/focus.c | |||
@@ -179,17 +179,17 @@ static struct cmd_results *focus_mode(struct sway_workspace *ws, | |||
179 | seat_set_focus_container(seat, new_focus); | 179 | seat_set_focus_container(seat, new_focus); |
180 | seat_consider_warp_to_focus(seat); | 180 | seat_consider_warp_to_focus(seat); |
181 | } else { | 181 | } else { |
182 | return cmd_results_new(CMD_FAILURE, "focus", | 182 | return cmd_results_new(CMD_FAILURE, |
183 | "Failed to find a %s container in workspace", | 183 | "Failed to find a %s container in workspace", |
184 | floating ? "floating" : "tiling"); | 184 | floating ? "floating" : "tiling"); |
185 | } | 185 | } |
186 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 186 | return cmd_results_new(CMD_SUCCESS, NULL); |
187 | } | 187 | } |
188 | 188 | ||
189 | static struct cmd_results *focus_output(struct sway_seat *seat, | 189 | static struct cmd_results *focus_output(struct sway_seat *seat, |
190 | int argc, char **argv) { | 190 | int argc, char **argv) { |
191 | if (!argc) { | 191 | if (!argc) { |
192 | return cmd_results_new(CMD_INVALID, "focus", | 192 | return cmd_results_new(CMD_INVALID, |
193 | "Expected 'focus output <direction|name>'"); | 193 | "Expected 'focus output <direction|name>'"); |
194 | } | 194 | } |
195 | char *identifier = join_args(argv, argc); | 195 | char *identifier = join_args(argv, argc); |
@@ -199,7 +199,7 @@ static struct cmd_results *focus_output(struct sway_seat *seat, | |||
199 | enum wlr_direction direction; | 199 | enum wlr_direction direction; |
200 | if (!parse_direction(identifier, &direction)) { | 200 | if (!parse_direction(identifier, &direction)) { |
201 | free(identifier); | 201 | free(identifier); |
202 | return cmd_results_new(CMD_INVALID, "focus", | 202 | return cmd_results_new(CMD_INVALID, |
203 | "There is no output with that name"); | 203 | "There is no output with that name"); |
204 | } | 204 | } |
205 | struct sway_workspace *ws = seat_get_focused_workspace(seat); | 205 | struct sway_workspace *ws = seat_get_focused_workspace(seat); |
@@ -223,21 +223,21 @@ static struct cmd_results *focus_output(struct sway_seat *seat, | |||
223 | seat_consider_warp_to_focus(seat); | 223 | seat_consider_warp_to_focus(seat); |
224 | } | 224 | } |
225 | 225 | ||
226 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 226 | return cmd_results_new(CMD_SUCCESS, NULL); |
227 | } | 227 | } |
228 | 228 | ||
229 | static struct cmd_results *focus_parent(void) { | 229 | static struct cmd_results *focus_parent(void) { |
230 | struct sway_seat *seat = config->handler_context.seat; | 230 | struct sway_seat *seat = config->handler_context.seat; |
231 | struct sway_container *con = config->handler_context.container; | 231 | struct sway_container *con = config->handler_context.container; |
232 | if (!con || con->is_fullscreen) { | 232 | if (!con || con->is_fullscreen) { |
233 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 233 | return cmd_results_new(CMD_SUCCESS, NULL); |
234 | } | 234 | } |
235 | struct sway_node *parent = node_get_parent(&con->node); | 235 | struct sway_node *parent = node_get_parent(&con->node); |
236 | if (parent) { | 236 | if (parent) { |
237 | seat_set_focus(seat, parent); | 237 | seat_set_focus(seat, parent); |
238 | seat_consider_warp_to_focus(seat); | 238 | seat_consider_warp_to_focus(seat); |
239 | } | 239 | } |
240 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 240 | return cmd_results_new(CMD_SUCCESS, NULL); |
241 | } | 241 | } |
242 | 242 | ||
243 | static struct cmd_results *focus_child(void) { | 243 | static struct cmd_results *focus_child(void) { |
@@ -248,15 +248,15 @@ static struct cmd_results *focus_child(void) { | |||
248 | seat_set_focus(seat, focus); | 248 | seat_set_focus(seat, focus); |
249 | seat_consider_warp_to_focus(seat); | 249 | seat_consider_warp_to_focus(seat); |
250 | } | 250 | } |
251 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 251 | return cmd_results_new(CMD_SUCCESS, NULL); |
252 | } | 252 | } |
253 | 253 | ||
254 | struct cmd_results *cmd_focus(int argc, char **argv) { | 254 | struct cmd_results *cmd_focus(int argc, char **argv) { |
255 | if (config->reading || !config->active) { | 255 | if (config->reading || !config->active) { |
256 | return cmd_results_new(CMD_DEFER, NULL, NULL); | 256 | return cmd_results_new(CMD_DEFER, NULL); |
257 | } | 257 | } |
258 | if (!root->outputs->length) { | 258 | if (!root->outputs->length) { |
259 | return cmd_results_new(CMD_INVALID, "focus", | 259 | return cmd_results_new(CMD_INVALID, |
260 | "Can't run this command while there's no outputs connected."); | 260 | "Can't run this command while there's no outputs connected."); |
261 | } | 261 | } |
262 | struct sway_node *node = config->handler_context.node; | 262 | struct sway_node *node = config->handler_context.node; |
@@ -264,7 +264,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) { | |||
264 | struct sway_workspace *workspace = config->handler_context.workspace; | 264 | struct sway_workspace *workspace = config->handler_context.workspace; |
265 | struct sway_seat *seat = config->handler_context.seat; | 265 | struct sway_seat *seat = config->handler_context.seat; |
266 | if (node->type < N_WORKSPACE) { | 266 | if (node->type < N_WORKSPACE) { |
267 | return cmd_results_new(CMD_FAILURE, "focus", | 267 | return cmd_results_new(CMD_FAILURE, |
268 | "Command 'focus' cannot be used above the workspace level"); | 268 | "Command 'focus' cannot be used above the workspace level"); |
269 | } | 269 | } |
270 | 270 | ||
@@ -274,7 +274,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) { | |||
274 | } | 274 | } |
275 | seat_set_focus_container(seat, container); | 275 | seat_set_focus_container(seat, container); |
276 | seat_consider_warp_to_focus(seat); | 276 | seat_consider_warp_to_focus(seat); |
277 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 277 | return cmd_results_new(CMD_SUCCESS, NULL); |
278 | } | 278 | } |
279 | 279 | ||
280 | if (strcmp(argv[0], "floating") == 0) { | 280 | if (strcmp(argv[0], "floating") == 0) { |
@@ -300,7 +300,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) { | |||
300 | 300 | ||
301 | enum wlr_direction direction = 0; | 301 | enum wlr_direction direction = 0; |
302 | if (!parse_direction(argv[0], &direction)) { | 302 | if (!parse_direction(argv[0], &direction)) { |
303 | return cmd_results_new(CMD_INVALID, "focus", | 303 | return cmd_results_new(CMD_INVALID, |
304 | "Expected 'focus <direction|parent|child|mode_toggle|floating|tiling>' " | 304 | "Expected 'focus <direction|parent|child|mode_toggle|floating|tiling>' " |
305 | "or 'focus output <direction|name>'"); | 305 | "or 'focus output <direction|name>'"); |
306 | } | 306 | } |
@@ -310,14 +310,14 @@ struct cmd_results *cmd_focus(int argc, char **argv) { | |||
310 | struct sway_output *new_output = | 310 | struct sway_output *new_output = |
311 | output_get_in_direction(workspace->output, direction); | 311 | output_get_in_direction(workspace->output, direction); |
312 | if (!new_output) { | 312 | if (!new_output) { |
313 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 313 | return cmd_results_new(CMD_SUCCESS, NULL); |
314 | } | 314 | } |
315 | 315 | ||
316 | struct sway_node *node = | 316 | struct sway_node *node = |
317 | get_node_in_output_direction(new_output, direction); | 317 | get_node_in_output_direction(new_output, direction); |
318 | seat_set_focus(seat, node); | 318 | seat_set_focus(seat, node); |
319 | seat_consider_warp_to_focus(seat); | 319 | seat_consider_warp_to_focus(seat); |
320 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 320 | return cmd_results_new(CMD_SUCCESS, NULL); |
321 | } | 321 | } |
322 | 322 | ||
323 | struct sway_node *next_focus = | 323 | struct sway_node *next_focus = |
@@ -327,5 +327,5 @@ struct cmd_results *cmd_focus(int argc, char **argv) { | |||
327 | seat_consider_warp_to_focus(seat); | 327 | seat_consider_warp_to_focus(seat); |
328 | } | 328 | } |
329 | 329 | ||
330 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 330 | return cmd_results_new(CMD_SUCCESS, NULL); |
331 | } | 331 | } |