From 462ad4ea8380f29ad7a81d65bc144cb0ac6f5d8f Mon Sep 17 00:00:00 2001 From: Brian Ashworth Date: Wed, 24 Apr 2019 20:28:19 -0400 Subject: cmd_move: respect workspace layout when inserting When moving a container to become a direct child of the workspace and the workspace's layout is tabbed or stacked, wrap it in a container with the same layout. This allows for the following: - Run `layout tabbed|stacked` on an empty workspace (or use `workspace_layout tabbed|stacked` in the config) - Open some views - Move one of the views in any direction - Open another view - The new container should also be `tabbed`/`stacked` --- sway/tree/container.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sway/tree/container.c') 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); } -- cgit v1.2.3-54-g00ecf