aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c6
-rw-r--r--sway/tree/workspace.c3
2 files changed, 7 insertions, 2 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 11ed4f98..c4d21f0a 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1385,8 +1385,10 @@ void container_replace(struct sway_container *container,
root_scratchpad_show(container);
root_scratchpad_remove_container(container);
}
- container_add_sibling(container, replacement, 1);
- container_detach(container);
+ if (container->parent || container->workspace) {
+ container_add_sibling(container, replacement, 1);
+ container_detach(container);
+ }
if (scratchpad) {
root_scratchpad_add_container(replacement);
}
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index 68a55e03..1a1f5c49 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -688,6 +688,9 @@ void workspace_insert_tiling(struct sway_workspace *workspace,
if (con->workspace) {
container_detach(con);
}
+ if (workspace->layout == L_STACKED || workspace->layout == L_TABBED) {
+ con = container_split(con, workspace->layout);
+ }
list_insert(workspace->tiling, index, con);
con->workspace = workspace;
container_for_each_child(con, set_workspace, NULL);