1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00
wtf/status/widget.go
2018-04-24 09:54:53 -07:00

61 lines
1.1 KiB
Go

package status
import (
//"fmt"
"time"
"github.com/olebedev/config"
"github.com/senorprogrammer/wtf/wtf"
)
// Config is a pointer to the global config object
var Config *config.Config
type Widget struct {
wtf.TextWidget
Current int
}
func NewWidget() *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(" 🎉 Status ", "status"),
Current: 0,
}
return &widget
}
/* -------------------- Exported Functions -------------------- */
func (widget *Widget) Refresh() {
if widget.Disabled() {
return
}
//_, _, w, _ := widget.View.GetInnerRect()
widget.View.Clear()
//fmt.Fprintf(
//widget.View,
//fmt.Sprintf("%%%ds\n", w-1),
//widget.Version,
//)
widget.RefreshedAt = time.Now()
}
/* -------------------- Unexported Functions -------------------- */
//func (widget *Widget) animation() string {
//icons := []string{"👍", "🤜", "🤙", "🤜", "🤘", "🤜", "✊", "🤜", "👌", "🤜"}
//next := icons[widget.Current]
//widget.Current = widget.Current + 1
//if widget.Current == len(icons) {
//widget.Current = 0
//}
//return next
//}