diff options
author | Drew DeVault <[email protected]> | 2015-08-09 20:10:26 -0400 |
---|---|---|
committer | Drew DeVault <[email protected]> | 2015-08-09 20:10:26 -0400 |
commit | 9f091c7f82a73144b4eb4ca4f5f800c811fbab46 (patch) | |
tree | 76726b112e18cc537e080568c7e5df30520a3ed9 /sway/commands.c | |
parent | 1669da719c96e80cc5c462bbd648b17c7cd25a82 (diff) |
Add movement support
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sway/commands.c b/sway/commands.c index 322c9519..12d38244 100644 --- a/sway/commands.c +++ b/sway/commands.c @@ -8,6 +8,7 @@ #include <ctype.h> #include "stringop.h" #include "layout.h" +#include "movement.h" #include "log.h" #include "commands.h" @@ -97,6 +98,23 @@ int cmd_exit(struct sway_config *config, int argc, char **argv) { return 0; } +int cmd_focus(struct sway_config *config, int argc, char **argv) { + if (argc != 1) { + sway_log(L_ERROR, "Invalid focus command (expected 1 arguments, got %d)", argc); + return 1; + } + if (strcasecmp(argv[0], "left") == 0) { + move_focus(MOVE_LEFT); + } else if (strcasecmp(argv[0], "right") == 0) { + move_focus(MOVE_RIGHT); + } else if (strcasecmp(argv[0], "up") == 0) { + move_focus(MOVE_UP); + } else if (strcasecmp(argv[0], "down") == 0) { + move_focus(MOVE_DOWN); + } + return 0; +} + int cmd_focus_follows_mouse(struct sway_config *config, int argc, char **argv) { if (argc != 1) { sway_log(L_ERROR, "Invalid focus_follows_mouse command (expected 1 arguments, got %d)", argc); @@ -184,6 +202,7 @@ struct cmd_handler handlers[] = { { "bindsym", cmd_bindsym }, { "exec", cmd_exec }, { "exit", cmd_exit }, + { "focus", cmd_focus }, { "focus_follows_mouse", cmd_focus_follows_mouse }, { "layout", cmd_layout }, { "set", cmd_set }, |