1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

WTF-400 Status extracted to new config format

This commit is contained in:
Chris Cummer 2019-04-16 02:55:59 -07:00
parent b4868a54e6
commit 5f07cb6db4
3 changed files with 25 additions and 3 deletions

View File

@ -283,7 +283,8 @@ func makeWidget(app *tview.Application, pages *tview.Pages, widgetName string) w
settings := spotifyweb.NewSettingsFromYAML(wtf.Config)
widget = spotifyweb.NewWidget(app, pages, settings)
case "status":
widget = status.NewWidget(app)
settings := status.NewSettingsFromYAML(wtf.Config)
widget = status.NewWidget(app, settings)
case "system":
widget = system.NewWidget(app, date, version)
case "textfile":

View File

@ -0,0 +1,18 @@
package status
import (
"github.com/olebedev/config"
"github.com/wtfutil/wtf/cfg"
)
type Settings struct {
common *cfg.Common
}
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
settings := Settings{
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
}
return &settings
}

View File

@ -9,12 +9,15 @@ type Widget struct {
wtf.TextWidget
CurrentIcon int
settings *Settings
}
func NewWidget(app *tview.Application) *Widget {
func NewWidget(app *tview.Application, settings *Settings) *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(app, "Status", "status", false),
TextWidget: wtf.NewTextWidget(app, "Status", "status", false),
CurrentIcon: 0,
settings: settings,
}
return &widget