Show jump panel keybindings in panel titles

This commit is contained in:
qihanghu 2024-11-25 16:20:40 +08:00
parent e58d5b963d
commit b8bf22ead8
2 changed files with 25 additions and 0 deletions

View file

@ -127,6 +127,9 @@ type GuiConfig struct {
// info and the status of the app). // info and the status of the app).
ShowBottomLine bool `yaml:"showBottomLine"` ShowBottomLine bool `yaml:"showBottomLine"`
// If true, show jump-to-window keybindings in window titles.
ShowPanelJumps bool `yaml:"showPanelJumps"`
// When true, increases vertical space used by focused side panel, // When true, increases vertical space used by focused side panel,
// creating an accordion effect // creating an accordion effect
ExpandFocusedSidePanel bool `yaml:"expandFocusedSidePanel"` ExpandFocusedSidePanel bool `yaml:"expandFocusedSidePanel"`

View file

@ -112,6 +112,8 @@ func (gui *Gui) createAllViews() error {
(*mapping.viewPtr).FgColor = gocui.ColorDefault (*mapping.viewPtr).FgColor = gocui.ColorDefault
} }
gui.configureViewProperties()
selectedLineBgColor := GetGocuiStyle(gui.Config.UserConfig.Gui.Theme.SelectedLineBgColor) selectedLineBgColor := GetGocuiStyle(gui.Config.UserConfig.Gui.Theme.SelectedLineBgColor)
gui.Views.Main.Wrap = gui.Config.UserConfig.Gui.WrapMainPanel gui.Views.Main.Wrap = gui.Config.UserConfig.Gui.WrapMainPanel
@ -175,6 +177,26 @@ func (gui *Gui) createAllViews() error {
return nil return nil
} }
func (gui *Gui) configureViewProperties() {
gui.Config.UserConfig.Gui.ShowPanelJumps = true
if gui.Config.UserConfig.Gui.ShowPanelJumps {
gui.Views.Project.TitlePrefix = "[1]"
// TODO service panel appear condition?
gui.Views.Services.TitlePrefix = "[2]"
gui.Views.Containers.TitlePrefix = "[3]"
gui.Views.Images.TitlePrefix = "[4]"
gui.Views.Volumes.TitlePrefix = "[5]"
gui.Views.Networks.TitlePrefix = "[6]"
} else {
gui.Views.Project.TitlePrefix = ""
gui.Views.Services.TitlePrefix = ""
gui.Views.Containers.TitlePrefix = ""
gui.Views.Images.TitlePrefix = ""
gui.Views.Volumes.TitlePrefix = ""
gui.Views.Networks.TitlePrefix = ""
}
}
func (gui *Gui) setInitialViewContent() error { func (gui *Gui) setInitialViewContent() error {
if err := gui.renderString(gui.g, "information", gui.getInformationContent()); err != nil { if err := gui.renderString(gui.g, "information", gui.getInformationContent()); err != nil {
return err return err