aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-04-02 13:49:37 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2018-04-06 09:43:52 -0400
commit57954a2b24f1e211c3b8811fb898ef4e076cb098 (patch)
treeb9977589b4b84811e31c0edec636252d04603ec7 /sway/commands
parentAvoid arranging windows while reloading config (diff)
downloadsway-57954a2b24f1e211c3b8811fb898ef4e076cb098.tar.gz
sway-57954a2b24f1e211c3b8811fb898ef4e076cb098.tar.zst
sway-57954a2b24f1e211c3b8811fb898ef4e076cb098.zip
Implement move [left|right|up|down]
The exact semantics of this command are complicated. I'll describe each test scenario as s-expressions. Everything assumes L_HORIZ if not specified, but if you rotate everything 90 degrees the same test cases hold. ``` (container (view a) (view b focus) (view c)) -> move left (container (view b focus) (view a) (view c)) (container (view a) (view b focus) (view c)) -> move right (container (view a) (view c) (view b focus)) (container L_VERT (view a)) (container L_HORIZ (view b) (view c focus)) -> move up (container L_VERT (view a) (view c focus)) (container L_HORIZ (view b)) (workspace (view a) (view b focus) (view c)) -> move up (workspace [split direction flipped] (view b focus) (container (view a) (view c))) (workspace (view a) (view b focus) (view c)) -> move down (workspace [split direction flipped] (container (view a) (view c)) (view b focus))) Note: outputs use wlr_output_layout instead of assuming that i+/-1 is the next output in the move direction. (root (output X11-1 (workspace 1)) (output X11-2 (workspace 1 (view a focus) (view b))))) -> move left (root (output X11-1 (workspace 1 (view a focus))) (output X11-2 (workspace 1 (view b))))) (root (output X11-1 (workspace 1 (container (view a) (view b))) (output X11-2 (workspace 1 (view c focus))))) -> move left (root (output X11-1 (workspace 1 (container (view a) (view b)) (view c focus))) (output X11-2 (workspace 1))) ```
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/move.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sway/commands/move.c b/sway/commands/move.c
index c954ab94..15a5ebc4 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -82,6 +82,8 @@ static struct cmd_results *cmd_move_container(struct sway_container *current,
82 config->handler_context.seat, ws); 82 config->handler_context.seat, ws);
83 container_move_to(current, focus); 83 container_move_to(current, focus);
84 seat_set_focus(config->handler_context.seat, old_parent); 84 seat_set_focus(config->handler_context.seat, old_parent);
85 container_reap_empty(old_parent);
86 container_reap_empty(focus->parent);
85 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 87 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
86 } else if (strcasecmp(argv[1], "to") == 0 88 } else if (strcasecmp(argv[1], "to") == 0
87 && strcasecmp(argv[2], "output") == 0) { 89 && strcasecmp(argv[2], "output") == 0) {
@@ -109,6 +111,8 @@ static struct cmd_results *cmd_move_container(struct sway_container *current,
109 struct sway_container *old_parent = current->parent; 111 struct sway_container *old_parent = current->parent;
110 container_move_to(current, focus); 112 container_move_to(current, focus);
111 seat_set_focus(config->handler_context.seat, old_parent); 113 seat_set_focus(config->handler_context.seat, old_parent);
114 container_reap_empty(old_parent);
115 container_reap_empty(focus->parent);
112 return cmd_results_new(CMD_SUCCESS, NULL, NULL); 116 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
113 } 117 }
114 return cmd_results_new(CMD_INVALID, "move", expected_syntax); 118 return cmd_results_new(CMD_INVALID, "move", expected_syntax);