sway/commands/layout: fix flatten parent once

only flatten if grandparent also has only a single
child
This commit is contained in:
Bonsaiiv 2025-10-14 19:50:21 +02:00
parent 90d3270970
commit ccb388c5c5

View file

@ -136,7 +136,7 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
container = container->pending.parent;
// If parent has only a singe child operate on its parent and
// flatten once, like i3
if (container && container->pending.children->length == 1) {
if (container && container->pending.children->length == 1 && container->pending.parent && container->pending.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);