Add Borders field to configuration (#76)

This commit is contained in:
ayntgl 2021-10-16 16:03:38 +04:00 • committed by GitHub
parent 62215312f0
commit 2bd2017f37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import (
"os"
"github.com/BurntSushi/toml"
"github.com/rivo/tview"
)
const userAgent = "" +
@ -69,14 +70,37 @@ type theme struct {
Text themeText
}
type borders struct {
Horizontal rune
Vertical rune
TopLeft rune
TopRight rune
BottomLeft rune
BottomRight rune
LeftT rune
RightT rune
TopT rune
BottomT rune
Cross rune
HorizontalFocus rune
VerticalFocus rune
TopLeftFocus rune
TopRightFocus rune
BottomLeftFocus rune
BottomRightFocus rune
}
type config struct {
Token string
UserAgent string
Mouse bool
Notifications bool
UserAgent string
GetMessagesLimit int
Theme theme
Keybindings keybindings
Borders borders
}
func loadConfig() *config {
@ -133,6 +157,7 @@ func loadConfig() *config {
Focus: "Alt+Rune[3]",
},
}
c.Borders = tview.Borders
err = toml.NewEncoder(f).Encode(c)
if err != nil {

View file

@ -24,6 +24,7 @@ var (
func main() {
conf = loadConfig()
tview.Borders = conf.Borders
tview.Styles.PrimitiveBackgroundColor = tcell.GetColor(conf.Theme.Background.Primitive)
tview.Styles.ContrastBackgroundColor = tcell.GetColor(conf.Theme.Background.Contrast)
tview.Styles.MoreContrastBackgroundColor = tcell.GetColor(conf.Theme.Background.MoreContrast)