aboutsummaryrefslogtreecommitdiff
path: root/src/layout.c
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-09-11 22:20:04 +0200
committerFederico Angelilli <code@fedang.net>2024-09-11 22:20:04 +0200
commitb94e342ea59c9d13ef1e380834534c1c1c8a83ec (patch)
tree17e7fcb888710927c78fd14003a103dc7e52ae27 /src/layout.c
parentee3ea3be13744f766af57e4ae4504b5942655184 (diff)
Add collapse option to groups
Diffstat (limited to 'src/layout.c')
-rw-r--r--src/layout.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/layout.c b/src/layout.c
index 6b6590e..92e6469 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -32,7 +32,12 @@ void layout_init(layout_t *layout, block_t *block, layout_info_t info)
layout->n_children++;
}
- if (layout->n_children > 0) {
+ if (block->group.collapse && layout->n_children == 1) {
+ layout_t *children = layout->children;
+ memcpy(layout, children, sizeof(layout_t));
+ free(children);
+
+ } else if (layout->n_children > 0) {
layout_t *last = &layout->children[layout->n_children - 1];
layout->width = last->x + last->width - x_offset;