Compare commits

...

9 Commits

Author SHA1 Message Date
bonsaiiV
6edb49f7f2
Merge c32e795053 into 980a4e0211 2024-08-31 14:08:56 +02:00
bonsaiiV
c32e795053
Merge branch 'master' into reduce-redundant-containers 2024-07-28 18:52:16 +00:00
bonsaiiV
74d1e2abea
Merge branch 'master' into reduce-redundant-containers 2024-04-03 11:19:23 +00:00
bonsaiiV
91f60f2268
Merge branch 'master' into reduce-redundant-containers 2024-03-02 10:14:23 +00:00
bonsaiiV
9118a45c5f
Merge branch 'master' into reduce-redundant-containers 2024-02-29 18:08:55 +00:00
bonsaiiV
5507c3b99b
Merge branch 'master' into reduce-redundant-containers 2024-02-28 18:30:10 +00:00
bonsaiiV
94620bb4a3
Merge branch 'master' into reduce-redundant-containers 2024-02-22 18:42:52 +00:00
Bonsaiiv
272d14f8ef matches i3 behavior
found the flatten function :)
i just followed it; not used it, as that is, what i3 is doing too
2024-02-07 21:37:00 +01:00
Bonsaiiv
fc63ed440a reduces redundant containers
Applying layout changes to the parent of the parent, in case the parent
only has a single child, stops the creation of a chain of single child
containers. The way of doing is hacky but i have no idea, what i am
doing.
2024-02-07 21:01:55 +01:00

View File

@ -134,6 +134,15 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
// Operate on parent container, like i3.
if (container) {
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) {
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;
}
}
// We could be working with a container OR a workspace. These are different