Add movement support

This commit is contained in:
Drew DeVault 2015-08-09 20:10:26 -04:00
parent 1669da719c
commit 9f091c7f82
6 changed files with 108 additions and 5 deletions

View file

@ -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 },