applied feedback

This commit is contained in:
Bonsaiiv 2025-10-15 12:11:38 +02:00
parent ccb388c5c5
commit fae7056ea7

View file

@ -136,7 +136,10 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
container = container->pending.parent; container = container->pending.parent;
// If parent has only a singe child operate on its parent and // If parent has only a singe child operate on its parent and
// flatten once, like i3 // flatten once, like i3
if (container && container->pending.children->length == 1 && container->pending.parent && container->pending.parent->pending.children->length == 1) { if (container && container->pending.children->length == 1) {
// Also check grandparent to avoid restricting layouts
struct sway_container *parent = container->pending.parent;
if (parent && parent->pending.children->length == 1) {
struct sway_container *child = container->pending.children->items[0]; struct sway_container *child = container->pending.children->items[0];
struct sway_container *parent = container->pending.parent; struct sway_container *parent = container->pending.parent;
container_replace(container, child); container_replace(container, child);
@ -144,6 +147,7 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
container = parent; container = parent;
} }
} }
}
// We could be working with a container OR a workspace. These are different // We could be working with a container OR a workspace. These are different
// structures, so we set up pointers to they layouts so we can refer them in // structures, so we set up pointers to they layouts so we can refer them in