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/workspace.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'sway/tree/workspace.c') 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); -- cgit v1.2.3-54-g00ecf