mirror of
https://github.com/swaywm/sway.git
synced 2026-04-17 06:46:32 -04:00
applied feedback
This commit is contained in:
parent
ccb388c5c5
commit
fae7056ea7
1 changed files with 9 additions and 5 deletions
|
|
@ -136,12 +136,16 @@ 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) {
|
||||||
struct sway_container *child = container->pending.children->items[0];
|
// Also check grandparent to avoid restricting layouts
|
||||||
struct sway_container *parent = container->pending.parent;
|
struct sway_container *parent = container->pending.parent;
|
||||||
container_replace(container, child);
|
if (parent && parent->pending.children->length == 1) {
|
||||||
container_begin_destroy(container);
|
struct sway_container *child = container->pending.children->items[0];
|
||||||
container = parent;
|
struct sway_container *parent = container->pending.parent;
|
||||||
|
container_replace(container, child);
|
||||||
|
container_begin_destroy(container);
|
||||||
|
container = parent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue