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:
parent
b4868a54e6
commit
5f07cb6db4
3
main.go
3
main.go
@ -283,7 +283,8 @@ func makeWidget(app *tview.Application, pages *tview.Pages, widgetName string) w
|
|||||||
settings := spotifyweb.NewSettingsFromYAML(wtf.Config)
|
settings := spotifyweb.NewSettingsFromYAML(wtf.Config)
|
||||||
widget = spotifyweb.NewWidget(app, pages, settings)
|
widget = spotifyweb.NewWidget(app, pages, settings)
|
||||||
case "status":
|
case "status":
|
||||||
widget = status.NewWidget(app)
|
settings := status.NewSettingsFromYAML(wtf.Config)
|
||||||
|
widget = status.NewWidget(app, settings)
|
||||||
case "system":
|
case "system":
|
||||||
widget = system.NewWidget(app, date, version)
|
widget = system.NewWidget(app, date, version)
|
||||||
case "textfile":
|
case "textfile":
|
||||||
|
18
modules/status/settings.go
Normal file
18
modules/status/settings.go
Normal 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
|
||||||
|
}
|
@ -9,12 +9,15 @@ type Widget struct {
|
|||||||
wtf.TextWidget
|
wtf.TextWidget
|
||||||
|
|
||||||
CurrentIcon int
|
CurrentIcon int
|
||||||
|
settings *Settings
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWidget(app *tview.Application) *Widget {
|
func NewWidget(app *tview.Application, settings *Settings) *Widget {
|
||||||
widget := Widget{
|
widget := Widget{
|
||||||
TextWidget: wtf.NewTextWidget(app, "Status", "status", false),
|
TextWidget: wtf.NewTextWidget(app, "Status", "status", false),
|
||||||
|
|
||||||
CurrentIcon: 0,
|
CurrentIcon: 0,
|
||||||
|
settings: settings,
|
||||||
}
|
}
|
||||||
|
|
||||||
return &widget
|
return &widget
|
||||||
|
Loading…
x
Reference in New Issue
Block a user