aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-06 18:10:02 -0400
committeremersion <contact@emersion.fr>2018-04-06 18:10:02 -0400
commit93ca8919f63c7022779c9780a24478559e7e47af (patch)
treea783cab9077629485453c9c706858cf533af7cec
parent37b173f326d89a43812dfab5846a3f04400ff94a (diff)
downloadsway-93ca8919f63c7022779c9780a24478559e7e47af.zip
sway-93ca8919f63c7022779c9780a24478559e7e47af.tar.gz
sway-93ca8919f63c7022779c9780a24478559e7e47af.tar.bz2
Don't rejigger if parent has two children
-rw-r--r--sway/tree/layout.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c
index 77b2448..78af8b8 100644
--- a/sway/tree/layout.c
+++ b/sway/tree/layout.c
@@ -331,11 +331,17 @@ void container_move(struct sway_container *container,
}
case C_WORKSPACE:
if (!is_parallel(current->layout, move_dir)) {
- if (current->children->length != 1) {
- // Special case
+ if (current->children->length > 2) {
wlr_log(L_DEBUG, "Rejiggering the workspace (%d kiddos)",
current->children->length);
workspace_rejigger(current, container, move_dir);
+ } else if (current->children->length == 2) {
+ wlr_log(L_DEBUG, "Changing workspace layout");
+ container_set_layout(current,
+ move_dir == MOVE_LEFT || move_dir == MOVE_RIGHT ?
+ L_HORIZ : L_VERT);
+ container_insert_child(current, container, offs < 0 ? 0 : 1);
+ arrange_windows(current, -1, -1);
}
return;
} else {