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

Bringing back the Status widget

This commit is contained in:
Chris Cummer 2018-05-09 08:56:34 -07:00
parent d246cb4c4a
commit 7adc0cdb11
2 changed files with 20 additions and 22 deletions

View File

@ -1,7 +1,7 @@
package status package status
import ( import (
//"fmt" "fmt"
"time" "time"
"github.com/olebedev/config" "github.com/olebedev/config"
@ -14,13 +14,13 @@ var Config *config.Config
type Widget struct { type Widget struct {
wtf.TextWidget wtf.TextWidget
Current int CurrentIcon int
} }
func NewWidget() *Widget { func NewWidget() *Widget {
widget := Widget{ widget := Widget{
TextWidget: wtf.NewTextWidget(" πŸŽ‰ Status ", "status", false), TextWidget: wtf.NewTextWidget(" πŸŽ‰ Status ", "status", false),
Current: 0, CurrentIcon: 0,
} }
return &widget return &widget
@ -33,28 +33,26 @@ func (widget *Widget) Refresh() {
return return
} }
//_, _, w, _ := widget.View.GetInnerRect()
widget.View.Clear() widget.View.Clear()
//fmt.Fprintf( fmt.Fprintf(
//widget.View, widget.View,
//fmt.Sprintf("%%%ds\n", w-1), "\n%s",
//widget.Version, widget.animation(),
//) )
widget.RefreshedAt = time.Now() widget.RefreshedAt = time.Now()
} }
/* -------------------- Unexported Functions -------------------- */ /* -------------------- Unexported Functions -------------------- */
//func (widget *Widget) animation() string { func (widget *Widget) animation() string {
//icons := []string{"πŸ‘", "🀜", "πŸ€™", "🀜", "🀘", "🀜", "✊", "🀜", "πŸ‘Œ", "🀜"} icons := []string{"πŸ‘", "🀜", "πŸ€™", "🀜", "🀘", "🀜", "✊", "🀜", "πŸ‘Œ", "🀜"}
//next := icons[widget.Current] next := icons[widget.CurrentIcon]
//widget.Current = widget.Current + 1 widget.CurrentIcon = widget.CurrentIcon + 1
//if widget.Current == len(icons) { if widget.CurrentIcon == len(icons) {
//widget.Current = 0 widget.CurrentIcon = 0
//} }
//return next return next
//} }

View File

@ -11,9 +11,9 @@ import (
var Config *config.Config var Config *config.Config
type TextWidget struct { type TextWidget struct {
enabled bool enabled bool
focusable bool
focusable bool
Name string Name string
RefreshedAt time.Time RefreshedAt time.Time
RefreshInt int RefreshInt int