From 633bee9019462ab7225e027c9ff84e6c06923a9d Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Thu, 31 May 2018 11:51:00 -0400 Subject: [PATCH 1/2] Fix moving out of tab/stack when only child --- sway/tree/layout.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 9594b75ad..6ee8b33b0 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c @@ -312,6 +312,19 @@ static void workspace_rejigger(struct sway_container *ws, static void move_out_of_tabs_stacks(struct sway_container *container, struct sway_container *current, enum movement_direction move_dir, int offs) { + if (container->parent == current->parent + && current->parent->children->length == 1) { + wlr_log(L_DEBUG, "Changing layout of %zd", current->parent->id); + current->parent->layout = move_dir = + MOVE_LEFT || move_dir == MOVE_RIGHT ? L_HORIZ : L_VERT; + if (current->parent->type == C_WORKSPACE) { + arrange_workspace(current->parent); + } else { + arrange_children_of(current->parent); + } + return; + } + wlr_log(L_DEBUG, "Moving out of tab/stack into a split"); bool is_workspace = current->parent->type == C_WORKSPACE; struct sway_container *old_parent = current->parent->parent; From e13c94f2dd375fee943bf676ab65ecf2b7cffbde Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Thu, 31 May 2018 12:07:54 -0400 Subject: [PATCH 2/2] Fix typo --- sway/tree/layout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 6ee8b33b0..b175f5670 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c @@ -315,7 +315,7 @@ static void move_out_of_tabs_stacks(struct sway_container *container, if (container->parent == current->parent && current->parent->children->length == 1) { wlr_log(L_DEBUG, "Changing layout of %zd", current->parent->id); - current->parent->layout = move_dir = + current->parent->layout = move_dir == MOVE_LEFT || move_dir == MOVE_RIGHT ? L_HORIZ : L_VERT; if (current->parent->type == C_WORKSPACE) { arrange_workspace(current->parent);