update block date (infiny loop)
This commit is contained in:
parent
84fd3269cc
commit
b3d57a5f94
|
@ -21,26 +21,29 @@ func runCalendar(wg *sync.WaitGroup) {
|
||||||
func main() {
|
func main() {
|
||||||
argFormat := flag.String("format", "%H:%M:%S %m-%d-%Y", "time format")
|
argFormat := flag.String("format", "%H:%M:%S %m-%d-%Y", "time format")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
now := time.Now()
|
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
if os.Getenv("BLOCK_BUTTON") == "1" {
|
for {
|
||||||
wg.Add(1)
|
now := time.Now()
|
||||||
go runCalendar(&wg)
|
|
||||||
|
if os.Getenv("BLOCK_BUTTON") == "1" {
|
||||||
|
wg.Add(1)
|
||||||
|
go runCalendar(&wg)
|
||||||
|
}
|
||||||
|
|
||||||
|
symbol := string(emoji.Calendar)
|
||||||
|
date := timefmt.Format(now, *argFormat)
|
||||||
|
|
||||||
|
options := r.NewBlockOptions()
|
||||||
|
options.FullText = r.TextWithRightPadding(fmt.Sprintf("%s %s", symbol, date), r.FB{
|
||||||
|
Foreground: r.Color("white"),
|
||||||
|
Background: r.Color("black4"),
|
||||||
|
})
|
||||||
|
|
||||||
|
block := r.Block("date", options)
|
||||||
|
fmt.Println(block)
|
||||||
|
time.Sleep(time.Millisecond * 500)
|
||||||
}
|
}
|
||||||
|
|
||||||
symbol := string(emoji.Calendar)
|
|
||||||
date := timefmt.Format(now, *argFormat)
|
|
||||||
|
|
||||||
options := r.NewBlockOptions()
|
|
||||||
options.FullText = r.TextWithRightPadding(fmt.Sprintf("%s %s", symbol, date), r.FB{
|
|
||||||
Foreground: r.Color("white"),
|
|
||||||
Background: r.Color("black4"),
|
|
||||||
})
|
|
||||||
|
|
||||||
block := r.Block("date", options)
|
|
||||||
fmt.Println(block)
|
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue