mirror of
https://github.com/swaywm/sway.git
synced 2025-10-29 05:40:18 -04:00
sway/commands/layout: fix flatten parent once
Fixes: f50e307227 ("sway/commands/layout: flatten parent once")
This commit is contained in:
parent
90d3270970
commit
b7eb6177e1
1 changed files with 8 additions and 4 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue