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

Cleaner config format and added simple_config.yml example

This commit is contained in:
Chris Cummer
2018-04-10 10:12:25 -07:00
committed by Chris Cummer
parent 948d5acb2a
commit 27a267b123
18 changed files with 285 additions and 133 deletions

View File

@@ -10,7 +10,13 @@ type Scheduler interface {
}
func Schedule(widget Scheduler) {
tick := time.NewTicker(time.Duration(widget.RefreshInterval()) * time.Second)
interval := time.Duration(widget.RefreshInterval()) * time.Second
if interval <= 0 {
return
}
tick := time.NewTicker(interval)
quit := make(chan struct{})
// Kick off the first refresh and then leave the rest to the timer

View File

@@ -23,14 +23,14 @@ type TextWidget struct {
func NewTextWidget(name string, configKey string) TextWidget {
widget := TextWidget{
enabled: Config.UBool(fmt.Sprintf("wtf.%s.enabled", configKey), false),
enabled: Config.UBool(fmt.Sprintf("wtf.mods.%s.enabled", configKey), false),
Name: name,
RefreshInt: Config.UInt(fmt.Sprintf("wtf.%s.refreshInterval", configKey)),
RefreshInt: Config.UInt(fmt.Sprintf("wtf.mods.%s.refreshInterval", configKey)),
Position: Position{
top: Config.UInt(fmt.Sprintf("wtf.%s.position.top", configKey)),
left: Config.UInt(fmt.Sprintf("wtf.%s.position.left", configKey)),
height: Config.UInt(fmt.Sprintf("wtf.%s.position.height", configKey)),
width: Config.UInt(fmt.Sprintf("wtf.%s.position.width", configKey)),
top: Config.UInt(fmt.Sprintf("wtf.mods.%s.position.top", configKey)),
left: Config.UInt(fmt.Sprintf("wtf.mods.%s.position.left", configKey)),
height: Config.UInt(fmt.Sprintf("wtf.mods.%s.position.height", configKey)),
width: Config.UInt(fmt.Sprintf("wtf.mods.%s.position.width", configKey)),
},
}