Add user config gui.horizontalPadding

This commit is contained in:
Stefan Haller 2024-06-14 11:25:44 +02:00
parent 851d17f456
commit a21c98b8d4
3 changed files with 14 additions and 1 deletions

View file

@ -157,6 +157,8 @@ type GuiConfig struct {
// Status panel view. // Status panel view.
// One of 'dashboard' (default) | 'allBranchesLog' // One of 'dashboard' (default) | 'allBranchesLog'
StatusPanelView string `yaml:"statusPanelView" jsonschema:"enum=dashboard,enum=allBranchesLog"` StatusPanelView string `yaml:"statusPanelView" jsonschema:"enum=dashboard,enum=allBranchesLog"`
// Horizontal padding between views that are next to each other.
HorizontalPadding int `yaml:"horizontalPadding"`
} }
func (c *GuiConfig) UseFuzzySearch() bool { func (c *GuiConfig) UseFuzzySearch() bool {
@ -703,6 +705,7 @@ func GetDefaultConfig() *UserConfig {
Rate: 50, Rate: 50,
}, },
StatusPanelView: "dashboard", StatusPanelView: "dashboard",
HorizontalPadding: 0,
}, },
Git: GitConfig{ Git: GitConfig{
Paging: PagingConfig{ Paging: PagingConfig{

View file

@ -125,8 +125,10 @@ func GetWindowDimensions(args WindowArrangementArgs) map[string]boxlayout.Dimens
sideSectionWeight, mainSectionWeight := getMidSectionWeights(args) sideSectionWeight, mainSectionWeight := getMidSectionWeights(args)
sidePanelsDirection := boxlayout.COLUMN sidePanelsDirection := boxlayout.COLUMN
sidePanelsPadding := args.UserConfig.Gui.HorizontalPadding
if shouldUsePortraitMode(args) { if shouldUsePortraitMode(args) {
sidePanelsDirection = boxlayout.ROW sidePanelsDirection = boxlayout.ROW
sidePanelsPadding = 0
} }
showInfoSection := args.UserConfig.Gui.ShowBottomLine || showInfoSection := args.UserConfig.Gui.ShowBottomLine ||
@ -143,6 +145,7 @@ func GetWindowDimensions(args WindowArrangementArgs) map[string]boxlayout.Dimens
Children: []*boxlayout.Box{ Children: []*boxlayout.Box{
{ {
Direction: sidePanelsDirection, Direction: sidePanelsDirection,
Padding: sidePanelsPadding,
Weight: 1, Weight: 1,
Children: []*boxlayout.Box{ Children: []*boxlayout.Box{
{ {
@ -173,13 +176,16 @@ func GetWindowDimensions(args WindowArrangementArgs) map[string]boxlayout.Dimens
func mainPanelChildren(args WindowArrangementArgs) []*boxlayout.Box { func mainPanelChildren(args WindowArrangementArgs) []*boxlayout.Box {
mainPanelsDirection := boxlayout.ROW mainPanelsDirection := boxlayout.ROW
mainPanelsPadding := 0
if splitMainPanelSideBySide(args) { if splitMainPanelSideBySide(args) {
mainPanelsDirection = boxlayout.COLUMN mainPanelsDirection = boxlayout.COLUMN
mainPanelsPadding = args.UserConfig.Gui.HorizontalPadding
} }
result := []*boxlayout.Box{ result := []*boxlayout.Box{
{ {
Direction: mainPanelsDirection, Direction: mainPanelsDirection,
Padding: mainPanelsPadding,
Children: mainSectionChildren(args), Children: mainSectionChildren(args),
Weight: 1, Weight: 1,
}, },

View file

@ -430,6 +430,10 @@
], ],
"description": "Status panel view.\nOne of 'dashboard' (default) | 'allBranchesLog'", "description": "Status panel view.\nOne of 'dashboard' (default) | 'allBranchesLog'",
"default": "dashboard" "default": "dashboard"
},
"horizontalPadding": {
"type": "integer",
"description": "Horizontal padding between views that are next to each other."
} }
}, },
"additionalProperties": false, "additionalProperties": false,