Merge pull request #529 from scottmckendry/master

feat: add 'border' option in config
This commit is contained in:
Jesse Duffield 2024-05-26 13:50:55 +10:00 committed by GitHub
commit ce780b8f6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View file

@ -33,6 +33,7 @@ to the top of your config file or via [Visual Studio Code settings.json config][
gui: gui:
scrollHeight: 2 scrollHeight: 2
language: 'auto' # one of 'auto' | 'en' | 'pl' | 'nl' | 'de' | 'tr' language: 'auto' # one of 'auto' | 'en' | 'pl' | 'nl' | 'de' | 'tr'
border: 'single' # one of 'single' | 'rounded' | 'double' | 'hidden'
theme: theme:
activeBorderColor: activeBorderColor:
- green - green

View file

@ -138,6 +138,10 @@ type GuiConfig struct {
// containers panel. "long": full words (default), "short": one or two characters, // containers panel. "long": full words (default), "short": one or two characters,
// "icon": unicode emoji. // "icon": unicode emoji.
ContainerStatusHealthStyle string `yaml:"containerStatusHealthStyle"` ContainerStatusHealthStyle string `yaml:"containerStatusHealthStyle"`
// Window border style.
// One of 'single' (default) | 'rounded' | 'double' | 'hidden'
Border string `yaml:"border"`
} }
// CommandTemplatesConfig determines what commands actually get called when we // CommandTemplatesConfig determines what commands actually get called when we

View file

@ -92,12 +92,23 @@ func (gui *Gui) orderedViewNameMappings() []viewNameMapping {
} }
func (gui *Gui) createAllViews() error { func (gui *Gui) createAllViews() error {
frameRunes := []rune{'─', '│', '┌', '┐', '└', '┘'}
switch gui.Config.UserConfig.Gui.Border {
case "double":
frameRunes = []rune{'═', '║', '╔', '╗', '╚', '╝'}
case "rounded":
frameRunes = []rune{'─', '│', '╭', '╮', '╰', '╯'}
case "hidden":
frameRunes = []rune{' ', ' ', ' ', ' ', ' ', ' '}
}
var err error var err error
for _, mapping := range gui.orderedViewNameMappings() { for _, mapping := range gui.orderedViewNameMappings() {
*mapping.viewPtr, err = gui.prepareView(mapping.name) *mapping.viewPtr, err = gui.prepareView(mapping.name)
if err != nil && err.Error() != UNKNOWN_VIEW_ERROR_MSG { if err != nil && err.Error() != UNKNOWN_VIEW_ERROR_MSG {
return err return err
} }
(*mapping.viewPtr).FrameRunes = frameRunes
(*mapping.viewPtr).FgColor = gocui.ColorDefault (*mapping.viewPtr).FgColor = gocui.ColorDefault
} }