Skip to content

Commit

Permalink
Merge pull request #529 from scottmckendry/master
Browse files Browse the repository at this point in the history
feat: add 'border' option in config
  • Loading branch information
jesseduffield authored May 26, 2024
2 parents 7f0f430 + 51b3bb5 commit ce780b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/Config.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ to the top of your config file or via [Visual Studio Code settings.json config][
gui:
scrollHeight: 2
language: 'auto' # one of 'auto' | 'en' | 'pl' | 'nl' | 'de' | 'tr'
border: 'single' # one of 'single' | 'rounded' | 'double' | 'hidden'
theme:
activeBorderColor:
- green
Expand Down
4 changes: 4 additions & 0 deletions pkg/config/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ type GuiConfig struct {
// containers panel. "long": full words (default), "short": one or two characters,
// "icon": unicode emoji.
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
Expand Down
11 changes: 11 additions & 0 deletions pkg/gui/views.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,23 @@ func (gui *Gui) orderedViewNameMappings() []viewNameMapping {
}

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
for _, mapping := range gui.orderedViewNameMappings() {
*mapping.viewPtr, err = gui.prepareView(mapping.name)
if err != nil && err.Error() != UNKNOWN_VIEW_ERROR_MSG {
return err
}
(*mapping.viewPtr).FrameRunes = frameRunes
(*mapping.viewPtr).FgColor = gocui.ColorDefault
}

Expand Down

0 comments on commit ce780b8

Please sign in to comment.