mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Widgets can inform whether or not they should get tab focus. Widgets that provide additional functionality should return true. Widgets that have no extra capability should return false. This allows the FocusTracker to only tab through and focus on widgets for which it provides value.
61 lines
1.1 KiB
Go
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", false),
|
|
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
|
|
//}
|