From d54c8e885b8bfc6b9922c575d77a5fbe2ac8a60a Mon Sep 17 00:00:00 2001 From: Ronan Pigott Date: Fri, 23 Oct 2020 17:08:30 -0700 Subject: [PATCH] commands/layout: don't change the layout of workspaces with children In i3 the layout command on a workspace affects the workspace layout only on empty workspaces. Otherwise children are placed in a new container with the desired layout to preserve the workspace layout. --- sway/commands/layout.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sway/commands/layout.c b/sway/commands/layout.c index 4b31b442..f2af183b 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c @@ -162,6 +162,12 @@ struct cmd_results *cmd_layout(int argc, char **argv) { } container->layout = new_layout; container_update_representation(container); + } else if (config->handler_context.container) { + // i3 avoids changing workspace layouts with a new container + // https://github.com/i3/i3/blob/3cd1c45eba6de073bc4300eebb4e1cc1a0c4479a/src/con.c#L1817 + container = workspace_wrap_children(workspace); + container->layout = new_layout; + container_update_representation(container); } else { if (old_layout != L_TABBED && old_layout != L_STACKED) { workspace->prev_split_layout = old_layout;