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

Added the System widget with basic build info

This commit is contained in:
Chris Cummer
2018-04-24 09:54:53 -07:00
parent 1559b1ea87
commit 7500a4031d
4 changed files with 84 additions and 24 deletions

View File

@@ -1,9 +1,7 @@
package status
import (
"fmt"
//"sort"
//"strings"
//"fmt"
"time"
"github.com/olebedev/config"
@@ -17,14 +15,12 @@ type Widget struct {
wtf.TextWidget
Current int
Version string
}
func NewWidget(version string) *Widget {
func NewWidget() *Widget {
widget := Widget{
TextWidget: wtf.NewTextWidget(" πŸŽ‰ Status ", "status"),
Current: 0,
Version: version,
}
return &widget
@@ -37,28 +33,28 @@ func (widget *Widget) Refresh() {
return
}
_, _, w, _ := widget.View.GetInnerRect()
//_, _, w, _ := widget.View.GetInnerRect()
widget.View.Clear()
fmt.Fprintf(
widget.View,
fmt.Sprintf("\n%%%ds", w-1),
widget.Version,
)
//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]
//func (widget *Widget) animation() string {
//icons := []string{"πŸ‘", "🀜", "πŸ€™", "🀜", "🀘", "🀜", "✊", "🀜", "πŸ‘Œ", "🀜"}
//next := icons[widget.Current]
widget.Current = widget.Current + 1
if widget.Current == len(icons) {
widget.Current = 0
}
//widget.Current = widget.Current + 1
//if widget.Current == len(icons) {
//widget.Current = 0
//}
return next
}
//return next
//}