Procházet zdrojové kódy

Add Borders field to configuration (#76)

ayntgl před 4 roky
rodič
revize
2bd2017f37
2 změnil soubory, kde provedl 27 přidání a 1 odebrání
  1. 26 1
      config.go
  2. 1 0
      main.go

+ 26 - 1
config.go

@@ -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 {

+ 1 - 0
main.go

@@ -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)