mirror of
https://github.com/swaywm/sway.git
synced 2024-11-10 12:33:50 +01:00
matches i3 behavior
found the flatten function :) i just followed it; not used it, as that is, what i3 is doing too
This commit is contained in:
parent
fc63ed440a
commit
272d14f8ef
@ -134,8 +134,14 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
|
|||||||
// Operate on parent container, like i3.
|
// Operate on parent container, like i3.
|
||||||
if (container) {
|
if (container) {
|
||||||
container = container->pending.parent;
|
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 = container->pending.parent;
|
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…
Reference in New Issue
Block a user