Skip to content

Commit dba7016

Browse files
committed
Add config.ROUNDED_CORNERS
1 parent 8961505 commit dba7016

File tree

5 files changed

+66
-1
lines changed

5 files changed

+66
-1
lines changed

config/struct.go

+10
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,15 @@ type ConfigS struct {
105105
// ```
106106
RedrawInterval int `mapstructure:"REDRAW_INTERVAL"`
107107

108+
// ## Rounded Corners
109+
//
110+
// Enable Rounded Corners for the UI. Defaults to True.
111+
//
112+
// ```yml
113+
// ROUNDED_CORNERS: True
114+
// ```
115+
RoundedCorners bool `mapstructure:"REDRAW_INTERVAL"`
116+
108117
// ## MPD Port
109118
// This is the port where your Music Player Daemon Is Running.
110119
//
@@ -241,5 +250,6 @@ func NewConfigS() *ConfigS {
241250
RedrawInterval: 500,
242251
Colors: NewColors(),
243252
GetCoverArtFromLastFm: false,
253+
RoundedCorners: true,
244254
}
245255
}

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.19
44

55
require (
66
github.com/aditya-K2/fuzzy v0.1.1-0.20211128173834-d0023b66cdd4
7-
github.com/aditya-K2/tview v0.0.0-20240609093139-fc55924ac006
7+
github.com/aditya-K2/tview v0.0.0-20230501091922-5da3458d3dff
88
github.com/aditya-K2/utils v0.0.0-20230324221547-e982ed1e980e
99
github.com/dhowden/tag v0.0.0-20220618230019-adf36e896086
1010
github.com/fhs/gompd/v2 v2.2.0

go.sum

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ github.com/aditya-K2/fuzzy v0.1.1-0.20211128173834-d0023b66cdd4 h1:GEy4yHiudZCZy
5656
github.com/aditya-K2/fuzzy v0.1.1-0.20211128173834-d0023b66cdd4/go.mod h1:82s+GWKOo176xBYRWstoAM6Fl5jpXNuZ1syuJvRwVN8=
5757
github.com/aditya-K2/tview v0.0.0-20230410122952-fb622a5db15f h1:9/fdQsE2KghxgOVPyB9stuz5LGr7/xNOhW8tq0lFizU=
5858
github.com/aditya-K2/tview v0.0.0-20230410122952-fb622a5db15f/go.mod h1:4mQQQ0q5F3GvKXtwNkViuvng/bNxt3Y3c95rGlULlv4=
59+
github.com/aditya-K2/tview v0.0.0-20230501091922-5da3458d3dff h1:ppQVp6+4XxXb0ypMIt5cItlc3+F1eouzVjYif/Err20=
60+
github.com/aditya-K2/tview v0.0.0-20230501091922-5da3458d3dff/go.mod h1:4mQQQ0q5F3GvKXtwNkViuvng/bNxt3Y3c95rGlULlv4=
5961
github.com/aditya-K2/tview v0.0.0-20240609093139-fc55924ac006 h1:9VkiLJ8X1/fK2ZZWtY91FLu+vsxWDGv2voOv+/8b2qo=
6062
github.com/aditya-K2/tview v0.0.0-20240609093139-fc55924ac006/go.mod h1:4mQQQ0q5F3GvKXtwNkViuvng/bNxt3Y3c95rGlULlv4=
6163
github.com/aditya-K2/utils v0.0.0-20230324221547-e982ed1e980e h1:blLZ2IHGPfAo2zOEpj4FsuqliHmpLw4u2Zp6GR0VMZ8=

main.go

+2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ func main() {
5858

5959
watchers.StartPlaylistWatcher()
6060

61+
ui.SetBorderRunes(config.Config.RoundedCorners)
62+
6163
if !config.Config.HideImage {
6264
watchers.StartRectWatcher()
6365
}

ui/styles.go

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package ui
2+
3+
import "github.com/aditya-K2/tview"
4+
5+
var (
6+
borders = map[bool]map[string]rune{
7+
true: {
8+
"TopLeft": '╭',
9+
"TopRight": '╮',
10+
"BottomRight": '╯',
11+
"BottomLeft": '╰',
12+
"Vertical": '│',
13+
"Horizontal": '─',
14+
"TopLeftFocus": '╭',
15+
"TopRightFocus": '╮',
16+
"BottomRightFocus": '╯',
17+
"BottomLeftFocus": '╰',
18+
"VerticalFocus": '│',
19+
"HorizontalFocus": '─',
20+
},
21+
false: {
22+
"TopLeft": tview.Borders.TopLeft,
23+
"TopRight": tview.Borders.TopRight,
24+
"BottomRight": tview.Borders.BottomRight,
25+
"BottomLeft": tview.Borders.BottomLeft,
26+
"Vertical": tview.Borders.Vertical,
27+
"Horizontal": tview.Borders.Horizontal,
28+
"TopLeftFocus": tview.Borders.TopLeftFocus,
29+
"TopRightFocus": tview.Borders.TopRightFocus,
30+
"BottomRightFocus": tview.Borders.BottomRightFocus,
31+
"BottomLeftFocus": tview.Borders.BottomLeftFocus,
32+
"VerticalFocus": tview.Borders.VerticalFocus,
33+
"HorizontalFocus": tview.Borders.HorizontalFocus,
34+
},
35+
}
36+
)
37+
38+
func SetBorderRunes(b bool) {
39+
tview.Borders.TopLeft = borders[b]["TopLeft"]
40+
tview.Borders.TopRight = borders[b]["TopRight"]
41+
tview.Borders.BottomRight = borders[b]["BottomRight"]
42+
tview.Borders.BottomLeft = borders[b]["BottomLeft"]
43+
tview.Borders.Vertical = borders[b]["Vertical"]
44+
tview.Borders.Horizontal = borders[b]["Horizontal"]
45+
tview.Borders.TopLeftFocus = borders[b]["TopLeftFocus"]
46+
tview.Borders.TopRightFocus = borders[b]["TopRightFocus"]
47+
tview.Borders.BottomRightFocus = borders[b]["BottomRightFocus"]
48+
tview.Borders.BottomLeftFocus = borders[b]["BottomLeftFocus"]
49+
tview.Borders.VerticalFocus = borders[b]["VerticalFocus"]
50+
tview.Borders.HorizontalFocus = borders[b]["HorizontalFocus"]
51+
}

0 commit comments

Comments
 (0)