mirror of
https://github.com/aditya-K2/gspt.git
synced 2026-01-10 06:18:03 -05:00
Implement Rounded Corners
This commit is contained in:
@@ -18,6 +18,7 @@ type ConfigS struct {
|
||||
ExtraImageWidthX float64 `mapstructure:"image_width_extra_x"`
|
||||
ExtraImageWidthY float64 `mapstructure:"image_width_extra_y"`
|
||||
HideImage bool `mapstructure:"hide_image"`
|
||||
RoundedCorners bool `mapstructure:"rounded_corners"`
|
||||
}
|
||||
|
||||
func NewConfigS() *ConfigS {
|
||||
@@ -30,6 +31,7 @@ func NewConfigS() *ConfigS {
|
||||
RedrawInterval: 500,
|
||||
Colors: NewColors(),
|
||||
HideImage: false,
|
||||
RoundedCorners: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,5 +9,7 @@ func parseFlags() {
|
||||
"Specify The Directory to check for config.yml file.")
|
||||
flag.BoolVar(&Config.HideImage, "hide-image", Config.HideImage,
|
||||
"Do not display the cover art image.")
|
||||
flag.BoolVar(&Config.RoundedCorners, "rounded-corners", Config.RoundedCorners,
|
||||
"Enable Rounded Corners")
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
20
ui/app.go
20
ui/app.go
@@ -5,9 +5,9 @@ import (
|
||||
|
||||
"github.com/aditya-K2/gspt/config"
|
||||
"github.com/aditya-K2/gspt/spt"
|
||||
"github.com/aditya-K2/tview"
|
||||
"github.com/aditya-K2/utils"
|
||||
"github.com/gdamore/tcell/v2"
|
||||
"github.com/aditya-K2/tview"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -29,6 +29,8 @@ var (
|
||||
NavStyle tcell.Style
|
||||
ContextMenuStyle tcell.Style
|
||||
NotSelectableStyle tcell.Style
|
||||
FocusBorderStyle tcell.Style = tcell.StyleDefault.Foreground(tcell.ColorRed)
|
||||
BorderStyle tcell.Style = tcell.StyleDefault.Foreground(tcell.ColorGrey)
|
||||
)
|
||||
|
||||
func onConfigChange() {
|
||||
@@ -59,6 +61,21 @@ type Application struct {
|
||||
}
|
||||
|
||||
func NewApplication() *Application {
|
||||
if config.Config.RoundedCorners {
|
||||
tview.Borders.TopLeft = '╭'
|
||||
tview.Borders.TopRight = '╮'
|
||||
tview.Borders.BottomRight = '╯'
|
||||
tview.Borders.BottomLeft = '╰'
|
||||
tview.Borders.Vertical = '│'
|
||||
tview.Borders.Horizontal = '─'
|
||||
tview.Borders.TopLeftFocus = '╭'
|
||||
tview.Borders.TopRightFocus = '╮'
|
||||
tview.Borders.BottomRightFocus = '╯'
|
||||
tview.Borders.BottomLeftFocus = '╰'
|
||||
tview.Borders.VerticalFocus = '│'
|
||||
tview.Borders.HorizontalFocus = '─'
|
||||
tview.Styles.BorderColorFocus = tcell.ColorRed
|
||||
}
|
||||
|
||||
App := tview.NewApplication()
|
||||
Root := NewRoot()
|
||||
@@ -275,7 +292,6 @@ func NewApplication() *Application {
|
||||
ImgX, ImgY, ImgW, ImgH = Ui.CoverArt.GetRect()
|
||||
}
|
||||
drawCh <- true
|
||||
|
||||
}()
|
||||
|
||||
go func() {
|
||||
|
||||
Reference in New Issue
Block a user