Skip to content

Commit 1b16733

Browse files
committed
Add StatusPanelView config
1 parent 49df908 commit 1b16733

File tree

4 files changed

+45
-20
lines changed

4 files changed

+45
-20
lines changed

docs/Config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ gui:
8686
border: 'rounded' # one of 'single' | 'double' | 'rounded' | 'hidden'
8787
animateExplosion: true # shows an explosion animation when nuking the working tree
8888
portraitMode: 'auto' # one of 'auto' | 'never' | 'always'
89+
statusPanelView: 'dashboard' # one of 'dashboard' | 'allBranchesLog'
8990
git:
9091
paging:
9192
colorArg: always

pkg/config/user_config.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ type GuiConfig struct {
142142
// Whether to stack UI components on top of each other.
143143
// One of 'auto' (default) | 'always' | 'never'
144144
PortraitMode string `yaml:"portraitMode"`
145+
// Status panel view.
146+
// One of 'dashboard' (default) | 'allBranchesLog'
147+
StatusPanelView string `yaml:"statusPanelView" jsonschema:"enum=dashboard,enum=allBranchesLog"`
145148
}
146149

147150
type ThemeConfig struct {
@@ -645,6 +648,7 @@ func GetDefaultConfig() *UserConfig {
645648
Border: "rounded",
646649
AnimateExplosion: true,
647650
PortraitMode: "auto",
651+
StatusPanelView: "dashboard",
648652
},
649653
Git: GitConfig{
650654
Paging: PagingConfig{

pkg/gui/controllers/status_controller.go

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,26 +68,15 @@ func (self *StatusController) GetKeybindings(opts types.KeybindingsOpts) []*type
6868
}
6969

7070
func (self *StatusController) GetOnRenderToMain() func() error {
71-
return func() error {
72-
dashboardString := strings.Join(
73-
[]string{
74-
lazygitTitle(),
75-
"Copyright 2022 Jesse Duffield",
76-
fmt.Sprintf("Keybindings: %s", constants.Links.Docs.Keybindings),
77-
fmt.Sprintf("Config Options: %s", constants.Links.Docs.Config),
78-
fmt.Sprintf("Tutorial: %s", constants.Links.Docs.Tutorial),
79-
fmt.Sprintf("Raise an Issue: %s", constants.Links.Issues),
80-
fmt.Sprintf("Release Notes: %s", constants.Links.Releases),
81-
style.FgMagenta.Sprintf("Become a sponsor: %s", constants.Links.Donate), // caffeine ain't free
82-
}, "\n\n")
83-
84-
return self.c.RenderToMainViews(types.RefreshMainOpts{
85-
Pair: self.c.MainViewPairs().Normal,
86-
Main: &types.ViewUpdateOpts{
87-
Title: self.c.Tr.StatusTitle,
88-
Task: types.NewRenderStringTask(dashboardString),
89-
},
90-
})
71+
config := self.c.UserConfig.Gui
72+
73+
switch config.StatusPanelView {
74+
case "dashboard":
75+
return self.showDashboard
76+
case "allBranchesLog":
77+
return self.showAllBranchLogs
78+
default:
79+
return self.showDashboard
9180
}
9281
}
9382

@@ -198,6 +187,28 @@ func (self *StatusController) showAllBranchLogs() error {
198187
})
199188
}
200189

190+
func (self *StatusController) showDashboard() error {
191+
dashboardString := strings.Join(
192+
[]string{
193+
lazygitTitle(),
194+
"Copyright 2022 Jesse Duffield",
195+
fmt.Sprintf("Keybindings: %s", constants.Links.Docs.Keybindings),
196+
fmt.Sprintf("Config Options: %s", constants.Links.Docs.Config),
197+
fmt.Sprintf("Tutorial: %s", constants.Links.Docs.Tutorial),
198+
fmt.Sprintf("Raise an Issue: %s", constants.Links.Issues),
199+
fmt.Sprintf("Release Notes: %s", constants.Links.Releases),
200+
style.FgMagenta.Sprintf("Become a sponsor: %s", constants.Links.Donate), // caffeine ain't free
201+
}, "\n\n")
202+
203+
return self.c.RenderToMainViews(types.RefreshMainOpts{
204+
Pair: self.c.MainViewPairs().Normal,
205+
Main: &types.ViewUpdateOpts{
206+
Title: self.c.Tr.StatusTitle,
207+
Task: types.NewRenderStringTask(dashboardString),
208+
},
209+
})
210+
}
211+
201212
func (self *StatusController) handleCheckForUpdate() error {
202213
return self.c.Helpers().Update.CheckForUpdateInForeground()
203214
}

schema/config.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,15 @@
357357
"type": "string",
358358
"description": "Whether to stack UI components on top of each other.\nOne of 'auto' (default) | 'always' | 'never'",
359359
"default": "auto"
360+
},
361+
"StatusPanelView": {
362+
"type": "string",
363+
"enum": [
364+
"dashboard",
365+
"allBranchesLog"
366+
],
367+
"description": "Status panel view.\nOne of 'dashboard' (default) | 'allBranchesLog'",
368+
"default": "dashboard"
360369
}
361370
},
362371
"additionalProperties": false,

0 commit comments

Comments
 (0)