diff options
author | S. Christoffer Eliesen <christoffer@eliesen.no> | 2015-10-24 03:31:54 +0200 |
---|---|---|
committer | S. Christoffer Eliesen <christoffer@eliesen.no> | 2015-10-28 20:06:48 +0100 |
commit | 5fa8f91655ccc0346a360e95a72237eb772c7e18 (patch) | |
tree | b35493c3ef4b83f8ef4b344ad7e0683e58200654 /sway/commands.c | |
parent | layout: Don't reset container size if it's a floating window. (diff) | |
download | sway-5fa8f91655ccc0346a360e95a72237eb772c7e18.tar.gz sway-5fa8f91655ccc0346a360e95a72237eb772c7e18.tar.zst sway-5fa8f91655ccc0346a360e95a72237eb772c7e18.zip |
commands: Learn 'focus output <direction|name>'
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c index c81379fd..441b6fd7 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "workspace.h" | 17 | #include "workspace.h" |
18 | #include "commands.h" | 18 | #include "commands.h" |
19 | #include "container.h" | 19 | #include "container.h" |
20 | #include "output.h" | ||
20 | #include "handlers.h" | 21 | #include "handlers.h" |
21 | #include "sway.h" | 22 | #include "sway.h" |
22 | #include "resize.h" | 23 | #include "resize.h" |
@@ -372,7 +373,20 @@ static struct cmd_results *cmd_floating_mod(int argc, char **argv) { | |||
372 | static struct cmd_results *cmd_focus(int argc, char **argv) { | 373 | static struct cmd_results *cmd_focus(int argc, char **argv) { |
373 | if (config->reading) return cmd_results_new(CMD_FAILURE, "focus", "Can't be used in config file."); | 374 | if (config->reading) return cmd_results_new(CMD_FAILURE, "focus", "Can't be used in config file."); |
374 | struct cmd_results *error = NULL; | 375 | struct cmd_results *error = NULL; |
375 | if ((error = checkarg(argc, "focus", EXPECTED_EQUAL_TO, 1))) { | 376 | if (argc > 0 && strcasecmp(argv[0], "output") == 0) { |
377 | swayc_t *output = NULL; | ||
378 | if ((error = checkarg(argc, "focus", EXPECTED_EQUAL_TO, 2))) { | ||
379 | return error; | ||
380 | } else if (!(output = output_by_name(argv[1]))) { | ||
381 | return cmd_results_new(CMD_FAILURE, "focus output", | ||
382 | "Can't find output with name/at direction %s", argv[1]); | ||
383 | } else if (!workspace_switch(swayc_active_workspace_for(output))) { | ||
384 | return cmd_results_new(CMD_FAILURE, "focus output", | ||
385 | "Switching to workspace on output '%s' was blocked", argv[1]); | ||
386 | } else { | ||
387 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | ||
388 | } | ||
389 | } else if ((error = checkarg(argc, "focus", EXPECTED_EQUAL_TO, 1))) { | ||
376 | return error; | 390 | return error; |
377 | } | 391 | } |
378 | static int floating_toggled_index = 0; | 392 | static int floating_toggled_index = 0; |
@@ -424,6 +438,9 @@ static struct cmd_results *cmd_focus(int argc, char **argv) { | |||
424 | } | 438 | } |
425 | } | 439 | } |
426 | } | 440 | } |
441 | } else { | ||
442 | return cmd_results_new(CMD_INVALID, "focus", | ||
443 | "Expected 'focus <direction|parent|mode_toggle>' or 'focus output <direction|name>'"); | ||
427 | } | 444 | } |
428 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 445 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
429 | } | 446 | } |