mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 04:15:48 +02:00
Add StatusPanelView config
This commit is contained in:
parent
4ba85608c8
commit
2b5c814080
4 changed files with 53 additions and 28 deletions
|
@ -90,6 +90,7 @@ gui:
|
||||||
spinner:
|
spinner:
|
||||||
frames: ['|', '/', '-', '\\']
|
frames: ['|', '/', '-', '\\']
|
||||||
rate: 50 # spinner rate in milliseconds
|
rate: 50 # spinner rate in milliseconds
|
||||||
|
statusPanelView: 'dashboard' # one of 'dashboard' | 'allBranchesLog'
|
||||||
git:
|
git:
|
||||||
paging:
|
paging:
|
||||||
colorArg: always
|
colorArg: always
|
||||||
|
|
|
@ -147,6 +147,9 @@ type GuiConfig struct {
|
||||||
FilterMode string `yaml:"filterMode" jsonschema:"enum=substring,enum=fuzzy"`
|
FilterMode string `yaml:"filterMode" jsonschema:"enum=substring,enum=fuzzy"`
|
||||||
// Config relating to the spinner.
|
// Config relating to the spinner.
|
||||||
Spinner SpinnerConfig `yaml:"spinner"`
|
Spinner SpinnerConfig `yaml:"spinner"`
|
||||||
|
// Status panel view.
|
||||||
|
// One of 'dashboard' (default) | 'allBranchesLog'
|
||||||
|
StatusPanelView string `yaml:"statusPanelView" jsonschema:"enum=dashboard,enum=allBranchesLog"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GuiConfig) UseFuzzySearch() bool {
|
func (c *GuiConfig) UseFuzzySearch() bool {
|
||||||
|
@ -684,6 +687,7 @@ func GetDefaultConfig() *UserConfig {
|
||||||
Frames: []string{"|", "/", "-", "\\"},
|
Frames: []string{"|", "/", "-", "\\"},
|
||||||
Rate: 50,
|
Rate: 50,
|
||||||
},
|
},
|
||||||
|
StatusPanelView: "dashboard",
|
||||||
},
|
},
|
||||||
Git: GitConfig{
|
Git: GitConfig{
|
||||||
Paging: PagingConfig{
|
Paging: PagingConfig{
|
||||||
|
|
|
@ -83,35 +83,15 @@ func (self *StatusController) onClickMain(opts gocui.ViewMouseBindingOpts) error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (self *StatusController) GetOnRenderToMain() func() error {
|
func (self *StatusController) GetOnRenderToMain() func() error {
|
||||||
versionStr := "master"
|
config := self.c.UserConfig.Gui
|
||||||
version, err := types.ParseVersionNumber(self.c.GetConfig().GetVersion())
|
|
||||||
if err == nil {
|
|
||||||
// Don't just take the version string as is, but format it again. This
|
|
||||||
// way it will be correct even if a distribution omits the "v", or the
|
|
||||||
// ".0" at the end.
|
|
||||||
versionStr = fmt.Sprintf("v%d.%d.%d", version.Major, version.Minor, version.Patch)
|
|
||||||
}
|
|
||||||
|
|
||||||
return func() error {
|
switch config.StatusPanelView {
|
||||||
dashboardString := strings.Join(
|
case "dashboard":
|
||||||
[]string{
|
return self.showDashboard
|
||||||
lazygitTitle(),
|
case "allBranchesLog":
|
||||||
"Copyright 2022 Jesse Duffield",
|
return self.showAllBranchLogs
|
||||||
fmt.Sprintf("Keybindings: %s", style.AttrUnderline.Sprint(fmt.Sprintf(constants.Links.Docs.Keybindings, versionStr))),
|
default:
|
||||||
fmt.Sprintf("Config Options: %s", style.AttrUnderline.Sprint(fmt.Sprintf(constants.Links.Docs.Config, versionStr))),
|
return self.showDashboard
|
||||||
fmt.Sprintf("Tutorial: %s", style.AttrUnderline.Sprint(constants.Links.Docs.Tutorial)),
|
|
||||||
fmt.Sprintf("Raise an Issue: %s", style.AttrUnderline.Sprint(constants.Links.Issues)),
|
|
||||||
fmt.Sprintf("Release Notes: %s", style.AttrUnderline.Sprint(constants.Links.Releases)),
|
|
||||||
style.FgMagenta.Sprintf("Become a sponsor: %s", style.AttrUnderline.Sprint(constants.Links.Donate)), // caffeine ain't free
|
|
||||||
}, "\n\n") + "\n"
|
|
||||||
|
|
||||||
return self.c.RenderToMainViews(types.RefreshMainOpts{
|
|
||||||
Pair: self.c.MainViewPairs().Normal,
|
|
||||||
Main: &types.ViewUpdateOpts{
|
|
||||||
Title: self.c.Tr.StatusTitle,
|
|
||||||
Task: types.NewRenderStringTask(dashboardString),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +204,37 @@ func (self *StatusController) showAllBranchLogs() error {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (self *StatusController) showDashboard() error {
|
||||||
|
versionStr := "master"
|
||||||
|
version, err := types.ParseVersionNumber(self.c.GetConfig().GetVersion())
|
||||||
|
if err == nil {
|
||||||
|
// Don't just take the version string as is, but format it again. This
|
||||||
|
// way it will be correct even if a distribution omits the "v", or the
|
||||||
|
// ".0" at the end.
|
||||||
|
versionStr = fmt.Sprintf("v%d.%d.%d", version.Major, version.Minor, version.Patch)
|
||||||
|
}
|
||||||
|
|
||||||
|
dashboardString := strings.Join(
|
||||||
|
[]string{
|
||||||
|
lazygitTitle(),
|
||||||
|
"Copyright 2022 Jesse Duffield",
|
||||||
|
fmt.Sprintf("Keybindings: %s", style.AttrUnderline.Sprint(fmt.Sprintf(constants.Links.Docs.Keybindings, versionStr))),
|
||||||
|
fmt.Sprintf("Config Options: %s", style.AttrUnderline.Sprint(fmt.Sprintf(constants.Links.Docs.Config, versionStr))),
|
||||||
|
fmt.Sprintf("Tutorial: %s", style.AttrUnderline.Sprint(constants.Links.Docs.Tutorial)),
|
||||||
|
fmt.Sprintf("Raise an Issue: %s", style.AttrUnderline.Sprint(constants.Links.Issues)),
|
||||||
|
fmt.Sprintf("Release Notes: %s", style.AttrUnderline.Sprint(constants.Links.Releases)),
|
||||||
|
style.FgMagenta.Sprintf("Become a sponsor: %s", style.AttrUnderline.Sprint(constants.Links.Donate)), // caffeine ain't free
|
||||||
|
}, "\n\n") + "\n"
|
||||||
|
|
||||||
|
return self.c.RenderToMainViews(types.RefreshMainOpts{
|
||||||
|
Pair: self.c.MainViewPairs().Normal,
|
||||||
|
Main: &types.ViewUpdateOpts{
|
||||||
|
Title: self.c.Tr.StatusTitle,
|
||||||
|
Task: types.NewRenderStringTask(dashboardString),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (self *StatusController) handleCheckForUpdate() error {
|
func (self *StatusController) handleCheckForUpdate() error {
|
||||||
return self.c.Helpers().Update.CheckForUpdateInForeground()
|
return self.c.Helpers().Update.CheckForUpdateInForeground()
|
||||||
}
|
}
|
||||||
|
|
|
@ -392,6 +392,15 @@
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"description": "Config relating to the spinner."
|
"description": "Config relating to the spinner."
|
||||||
|
},
|
||||||
|
"statusPanelView": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"dashboard",
|
||||||
|
"allBranchesLog"
|
||||||
|
],
|
||||||
|
"description": "Status panel view.\nOne of 'dashboard' (default) | 'allBranchesLog'",
|
||||||
|
"default": "dashboard"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false,
|
"additionalProperties": false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue