diff options
Diffstat (limited to 'sway/commands.c')
-rw-r--r-- | sway/commands.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sway/commands.c b/sway/commands.c index f194681e..dfb3c12d 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -377,11 +377,13 @@ static struct cmd_results *cmd_focus(int argc, char **argv) { | |||
377 | struct cmd_results *error = NULL; | 377 | struct cmd_results *error = NULL; |
378 | if (argc > 0 && strcasecmp(argv[0], "output") == 0) { | 378 | if (argc > 0 && strcasecmp(argv[0], "output") == 0) { |
379 | swayc_t *output = NULL; | 379 | swayc_t *output = NULL; |
380 | struct wlc_point abs_pos; | ||
381 | get_absolute_center_position(get_focused_container(&root_container), &abs_pos); | ||
380 | if ((error = checkarg(argc, "focus", EXPECTED_EQUAL_TO, 2))) { | 382 | if ((error = checkarg(argc, "focus", EXPECTED_EQUAL_TO, 2))) { |
381 | return error; | 383 | return error; |
382 | } else if (!(output = output_by_name(argv[1]))) { | 384 | } else if (!(output = output_by_name(argv[1], &abs_pos))) { |
383 | return cmd_results_new(CMD_FAILURE, "focus output", | 385 | return cmd_results_new(CMD_FAILURE, "focus output", |
384 | "Can't find output with name/at direction %s", argv[1]); | 386 | "Can't find output with name/at direction '%s' @ (%i,%i)", argv[1], abs_pos.x, abs_pos.y); |
385 | } else if (!workspace_switch(swayc_active_workspace_for(output))) { | 387 | } else if (!workspace_switch(swayc_active_workspace_for(output))) { |
386 | return cmd_results_new(CMD_FAILURE, "focus output", | 388 | return cmd_results_new(CMD_FAILURE, "focus output", |
387 | "Switching to workspace on output '%s' was blocked", argv[1]); | 389 | "Switching to workspace on output '%s' was blocked", argv[1]); |
@@ -591,11 +593,13 @@ static struct cmd_results *cmd_move(int argc, char **argv) { | |||
591 | } else if (strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "output") == 0) { | 593 | } else if (strcasecmp(argv[1], "to") == 0 && strcasecmp(argv[2], "output") == 0) { |
592 | // move container to output x | 594 | // move container to output x |
593 | swayc_t *output = NULL; | 595 | swayc_t *output = NULL; |
596 | struct wlc_point abs_pos; | ||
597 | get_absolute_center_position(view, &abs_pos); | ||
594 | if (view->type != C_CONTAINER && view->type != C_VIEW) { | 598 | if (view->type != C_CONTAINER && view->type != C_VIEW) { |
595 | return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views."); | 599 | return cmd_results_new(CMD_FAILURE, "move", "Can only move containers and views."); |
596 | } else if (!(output = output_by_name(argv[3]))) { | 600 | } else if (!(output = output_by_name(argv[3], &abs_pos))) { |
597 | return cmd_results_new(CMD_FAILURE, "move", | 601 | return cmd_results_new(CMD_FAILURE, "move", |
598 | "Can't find output with name/direction '%s'", argv[3]); | 602 | "Can't find output with name/direction '%s' @ (%i,%i)", argv[3], abs_pos.x, abs_pos.y); |
599 | } else { | 603 | } else { |
600 | swayc_t *container = get_focused_container(output); | 604 | swayc_t *container = get_focused_container(output); |
601 | if (container->is_floating) { | 605 | if (container->is_floating) { |
@@ -610,13 +614,15 @@ static struct cmd_results *cmd_move(int argc, char **argv) { | |||
610 | } else if (strcasecmp(argv[0], "workspace") == 0) { | 614 | } else if (strcasecmp(argv[0], "workspace") == 0) { |
611 | // move workspace (to output x) | 615 | // move workspace (to output x) |
612 | swayc_t *output = NULL; | 616 | swayc_t *output = NULL; |
617 | struct wlc_point abs_pos; | ||
618 | get_absolute_center_position(view, &abs_pos); | ||
613 | if ((error = checkarg(argc, "move workspace", EXPECTED_EQUAL_TO, 4))) { | 619 | if ((error = checkarg(argc, "move workspace", EXPECTED_EQUAL_TO, 4))) { |
614 | return error; | 620 | return error; |
615 | } else if (strcasecmp(argv[1], "to") != 0 || strcasecmp(argv[2], "output") != 0) { | 621 | } else if (strcasecmp(argv[1], "to") != 0 || strcasecmp(argv[2], "output") != 0) { |
616 | return cmd_results_new(CMD_INVALID, "move", expected_syntax); | 622 | return cmd_results_new(CMD_INVALID, "move", expected_syntax); |
617 | } else if (!(output = output_by_name(argv[3]))) { | 623 | } else if (!(output = output_by_name(argv[3], &abs_pos))) { |
618 | return cmd_results_new(CMD_FAILURE, "move workspace", | 624 | return cmd_results_new(CMD_FAILURE, "move workspace", |
619 | "Can't find output with name/at direction '%s'", argv[3]); | 625 | "Can't find output with name/direction '%s' @ (%i,%i)", argv[3], abs_pos.x, abs_pos.y); |
620 | } | 626 | } |
621 | if (view->type == C_WORKSPACE) { | 627 | if (view->type == C_WORKSPACE) { |
622 | // This probably means we're moving an empty workspace, but | 628 | // This probably means we're moving an empty workspace, but |