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:
parent
d246cb4c4a
commit
7adc0cdb11
@ -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
|
||||||
//}
|
}
|
||||||
|
@ -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
|
||||||
|
Loadingβ¦
x
Reference in New Issue
Block a user