diff options
| author | bonsaiiV <68749581+bonsaiiV@users.noreply.github.com> | 2025-10-18 16:55:46 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-18 18:55:46 +0200 |
| commit | b7eb6177e1d634620d73d56224cf154e3b854e0f (patch) | |
| tree | 3741283ba186f0547018352dba9618040f0053a2 | |
| parent | 90d3270970cc963454455b572883a051d3f376a1 (diff) | |
sway/commands/layout: fix flatten parent onceinput-fix_context_menu_focus
Fixes: f50e307227c8 ("sway/commands/layout: flatten parent once")
| -rw-r--r-- | sway/commands/layout.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sway/commands/layout.c b/sway/commands/layout.c index a32c908b..22dfdf3d 100644 --- a/sway/commands/layout.c +++ b/sway/commands/layout.c @@ -137,11 +137,15 @@ struct cmd_results *cmd_layout(int argc, char **argv) { // If parent has only a singe child operate on its parent and // flatten once, like i3 if (container && container->pending.children->length == 1) { - struct sway_container *child = container->pending.children->items[0]; + // Also check grandparent to avoid restricting layouts struct sway_container *parent = container->pending.parent; - container_replace(container, child); - container_begin_destroy(container); - container = parent; + if (parent && parent->pending.children->length == 1) { + struct sway_container *child = container->pending.children->items[0]; + struct sway_container *parent = container->pending.parent; + container_replace(container, child); + container_begin_destroy(container); + container = parent; + } } } |
