diff options
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/sway/commands.c b/sway/commands.c index d1bbdc89..cb96703e 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -206,7 +206,7 @@ static bool cmd_floating(struct sway_config *config, int argc, char **argv) { | |||
206 | if (!view->is_floating) { | 206 | if (!view->is_floating) { |
207 | // Remove view from its current location | 207 | // Remove view from its current location |
208 | destroy_container(remove_child(view)); | 208 | destroy_container(remove_child(view)); |
209 | 209 | ||
210 | // and move it into workspace floating | 210 | // and move it into workspace floating |
211 | add_floating(active_workspace,view); | 211 | add_floating(active_workspace,view); |
212 | view->x = (active_workspace->width - view->width)/2; | 212 | view->x = (active_workspace->width - view->width)/2; |
@@ -341,6 +341,27 @@ static bool cmd_focus_follows_mouse(struct sway_config *config, int argc, char * | |||
341 | return true; | 341 | return true; |
342 | } | 342 | } |
343 | 343 | ||
344 | static bool cmd_move(struct sway_config *config, int argc, char **argv) { | ||
345 | if (!checkarg(argc, "workspace", EXPECTED_EQUAL_TO, 1)) { | ||
346 | return false; | ||
347 | } | ||
348 | |||
349 | swayc_t *view = get_focused_container(&root_container); | ||
350 | |||
351 | if (strcasecmp(argv[0], "left") == 0) { | ||
352 | move_container(view,&root_container,MOVE_LEFT); | ||
353 | } else if (strcasecmp(argv[0], "right") == 0) { | ||
354 | move_container(view,&root_container,MOVE_RIGHT); | ||
355 | } else if (strcasecmp(argv[0], "up") == 0) { | ||
356 | move_container(view,&root_container,MOVE_UP); | ||
357 | } else if (strcasecmp(argv[0], "down") == 0) { | ||
358 | move_container(view,&root_container,MOVE_DOWN); | ||
359 | } else { | ||
360 | return false; | ||
361 | } | ||
362 | return true; | ||
363 | } | ||
364 | |||
344 | static bool cmd_gaps(struct sway_config *config, int argc, char **argv) { | 365 | static bool cmd_gaps(struct sway_config *config, int argc, char **argv) { |
345 | if (!checkarg(argc, "gaps", EXPECTED_AT_LEAST, 1)) { | 366 | if (!checkarg(argc, "gaps", EXPECTED_AT_LEAST, 1)) { |
346 | return false; | 367 | return false; |
@@ -736,6 +757,7 @@ static struct cmd_handler handlers[] = { | |||
736 | { "kill", cmd_kill }, | 757 | { "kill", cmd_kill }, |
737 | { "layout", cmd_layout }, | 758 | { "layout", cmd_layout }, |
738 | { "log_colors", cmd_log_colors }, | 759 | { "log_colors", cmd_log_colors }, |
760 | { "move", cmd_move}, | ||
739 | { "reload", cmd_reload }, | 761 | { "reload", cmd_reload }, |
740 | { "resize", cmd_resize }, | 762 | { "resize", cmd_resize }, |
741 | { "set", cmd_set }, | 763 | { "set", cmd_set }, |