From eb0724c57f34c31fc2801932344b575c5adc6e3b Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Sun, 18 Apr 2021 15:15:43 -0700 Subject: [PATCH] workspace: reap empty parents when adding tiles (cherry picked from commit c12169953abd393506367b949a63de5928ad9518) --- sway/tree/workspace.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c index 4e73506404..c0da9c9349 100644 --- a/sway/tree/workspace.c +++ b/sway/tree/workspace.c @@ -794,7 +794,11 @@ void workspace_detach(struct sway_workspace *workspace) { struct sway_container *workspace_add_tiling(struct sway_workspace *workspace, struct sway_container *con) { if (con->pending.workspace) { + struct sway_container *old_parent = con->pending.parent; container_detach(con); + if (old_parent) { + container_reap_empty(old_parent); + } } if (config->default_layout != L_NONE) { con = container_split(con, config->default_layout);