diff --git a/docs/Config.md b/docs/Config.md index b14ee993ae0..02272324bd0 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -68,6 +68,10 @@ gui: # If true, increase the height of the focused side window; creating an accordion effect. expandFocusedSidePanel: false + # The weight of the expanded side panel, relative to the other panels. 2 means + # twice as heigh as the other panels. Only relevant if `expandFocusedSidePanel` is true. + expandedSidePanelWeight: 2 + # Sometimes the main window is split in two (e.g. when the selected file has both staged and unstaged changes). This setting controls how the two sections are split. # Options are: # - 'horizontal': split the window horizontally diff --git a/pkg/config/user_config.go b/pkg/config/user_config.go index a5f65165d7b..7a958c7a5b5 100644 --- a/pkg/config/user_config.go +++ b/pkg/config/user_config.go @@ -77,6 +77,9 @@ type GuiConfig struct { SidePanelWidth float64 `yaml:"sidePanelWidth" jsonschema:"maximum=1,minimum=0"` // If true, increase the height of the focused side window; creating an accordion effect. ExpandFocusedSidePanel bool `yaml:"expandFocusedSidePanel"` + // The weight of the expanded side panel, relative to the other panels. 2 means + // twice as heigh as the other panels. Only relevant if `expandFocusedSidePanel` is true. + ExpandedSidePanelWeight int `yaml:"expandedSidePanelWeight"` // Sometimes the main window is split in two (e.g. when the selected file has both staged and unstaged changes). This setting controls how the two sections are split. // Options are: // - 'horizontal': split the window horizontally @@ -651,6 +654,7 @@ func GetDefaultConfig() *UserConfig { SkipStashWarning: false, SidePanelWidth: 0.3333, ExpandFocusedSidePanel: false, + ExpandedSidePanelWeight: 2, MainPanelSplitMode: "flexible", EnlargedSideViewLocation: "left", Language: "auto", diff --git a/pkg/gui/controllers/helpers/window_arrangement_helper.go b/pkg/gui/controllers/helpers/window_arrangement_helper.go index 8615769dc1b..5c17083f7f4 100644 --- a/pkg/gui/controllers/helpers/window_arrangement_helper.go +++ b/pkg/gui/controllers/helpers/window_arrangement_helper.go @@ -443,7 +443,7 @@ func sidePanelChildren(args WindowArrangementArgs) func(width int, height int) [ if accordionMode && defaultBox.Window == args.CurrentSideWindow { return &boxlayout.Box{ Window: defaultBox.Window, - Weight: 2, + Weight: args.UserConfig.Gui.ExpandedSidePanelWeight, } } diff --git a/pkg/gui/controllers/helpers/window_arrangement_helper_test.go b/pkg/gui/controllers/helpers/window_arrangement_helper_test.go index 47c48fb7a65..b429e00ae42 100644 --- a/pkg/gui/controllers/helpers/window_arrangement_helper_test.go +++ b/pkg/gui/controllers/helpers/window_arrangement_helper_test.go @@ -161,6 +161,47 @@ func TestGetWindowDimensions(t *testing.T) { B: information `, }, + { + name: "expandSidePanelWeight", + mutateArgs: func(args *WindowArrangementArgs) { + args.UserConfig.Gui.ExpandFocusedSidePanel = true + args.UserConfig.Gui.ExpandedSidePanelWeight = 4 + }, + expected: ` + ╭status─────────────────╮╭main────────────────────────────────────────────╮ + │ ││ │ + ╰───────────────────────╯│ │ + ╭files──────────────────╮│ │ + │ ││ │ + │ ││ │ + │ ││ │ + │ ││ │ + │ ││ │ + │ ││ │ + │ ││ │ + │ ││ │ + │ ││ │ + │ ││ │ + │ ││ │ + │ ││ │ + │ ││ │ + ╰───────────────────────╯│ │ + ╭branches───────────────╮│ │ + │ ││ │ + │ ││ │ + ╰───────────────────────╯│ │ + ╭commits────────────────╮│ │ + │ ││ │ + │ ││ │ + ╰───────────────────────╯│ │ + ╭stash──────────────────╮│ │ + │ ││ │ + ╰───────────────────────╯╰────────────────────────────────────────────────╯ + A + A: statusSpacer1 + B: information + `, + }, { name: "half screen mode, enlargedSideViewLocation left", mutateArgs: func(args *WindowArrangementArgs) { diff --git a/schema/config.json b/schema/config.json index a5c704db0cb..3d3e31366d9 100644 --- a/schema/config.json +++ b/schema/config.json @@ -76,6 +76,11 @@ "description": "If true, increase the height of the focused side window; creating an accordion effect.", "default": false }, + "expandedSidePanelWeight": { + "type": "integer", + "description": "The weight of the expanded side panel, relative to the other panels. 2 means\ntwice as heigh as the other panels. Only relevant if `expandFocusedSidePanel` is true.", + "default": 2 + }, "mainPanelSplitMode": { "type": "string", "enum": [