From b039d98b09ddc2540b76ad8d53bac0df57a58574 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Wed, 1 Jul 2026 17:05:11 +0200 Subject: [PATCH] Scale the side-panel layout height thresholds by panel count The height thresholds that decide between the proportional layout and the squashed layout (and, within the squashed layout, between 3-row and 1-row unfocused panels) were hard-coded constants tuned for the fixed set of five side panels. Now that the panels are configurable, a layout with fewer panels has less to fit, yet was still forced into the squashed layout at the same height as five panels would be. Scale the thresholds down in proportion to the panel count so a smaller layout keeps using the proportional layout at smaller heights. Only ever scale down: raising the thresholds for more panels would make them squash sooner, which works against the reason someone adds panels in the first place (they want to see them). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../helpers/window_arrangement_helper.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/gui/controllers/helpers/window_arrangement_helper.go b/pkg/gui/controllers/helpers/window_arrangement_helper.go index 610c57f52..37a4465b1 100644 --- a/pkg/gui/controllers/helpers/window_arrangement_helper.go +++ b/pkg/gui/controllers/helpers/window_arrangement_helper.go @@ -430,6 +430,15 @@ func sidePanelChildren(args WindowArrangementArgs) func(width int, height int) [ return func(width int, height int) []*boxlayout.Box { windows := sideWindowNames(args.UserConfig) + // These thresholds were originally tuned for the default five side panels. + // With fewer panels there's less to fit, so scale them down proportionally + // to keep using the proportional layout at smaller heights rather than + // squashing unnecessarily. We only ever scale down: making more panels + // squash sooner tends to work against the reason people add panels. + const defaultSidePanelCount = 5 + minHeightForNormalLayout := min(28, 28*len(windows)/defaultSidePanelCount) + minHeightForTallSquashedPanels := min(21, 21*len(windows)/defaultSidePanelCount) + boxForEachWindow := func(boxForWindow func(window string) *boxlayout.Box) []*boxlayout.Box { boxes := make([]*boxlayout.Box, 0, len(windows)) for _, window := range windows { @@ -454,7 +463,7 @@ func sidePanelChildren(args WindowArrangementArgs) func(width int, height int) [ } return boxForEachWindow(fullHeightBox) - } else if height >= 28 { + } else if height >= minHeightForNormalLayout { accordionMode := args.UserConfig.Gui.ExpandFocusedSidePanel accordionBox := func(defaultBox *boxlayout.Box) *boxlayout.Box { if accordionMode && defaultBox.Window == args.CurrentSideWindow { @@ -487,7 +496,7 @@ func sidePanelChildren(args WindowArrangementArgs) func(width int, height int) [ } squashedHeight := 1 - if height >= 21 { + if height >= minHeightForTallSquashedPanels { squashedHeight = 3 }