summaryrefslogtreecommitdiff
path: root/init.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-08 12:50:05 -0600
committerJeff Carr <[email protected]>2025-02-08 12:50:05 -0600
commit90083d5bcb2df4b526a04213c07392fe72cb816c (patch)
treeb7c55d340d52e445a2baa08869de8569a196005e /init.go
parent77b4bcb94b64d327c8bb3b3df2cedacd7d9fdae6 (diff)
a clock
Diffstat (limited to 'init.go')
-rw-r--r--init.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/init.go b/init.go
index fa57a64..d950806 100644
--- a/init.go
+++ b/init.go
@@ -49,6 +49,7 @@ func init() {
me.dropdown.wId = -77
me.textbox.wId = -55
me.stdout.wId = -4
+ me.clock.wId = -5
me.mouse.mouseUp = true
me.mouse.clicktime = time.Millisecond * 100
@@ -230,16 +231,24 @@ func refreshGocui() {
var lastRefresh time.Time
lastRefresh = time.Now()
for {
- time.Sleep(10 * time.Millisecond)
+ time.Sleep(100 * time.Millisecond)
// log.Info("refresh checking ok")
if !me.ok {
continue
}
- if time.Since(lastRefresh) > 100*time.Millisecond {
+ if time.Since(lastRefresh) > 1000*time.Millisecond {
if me.mouse.mouseUp {
// log.Info("refresh now on mouseUp")
// todo: add logic here to see if the application has changed anything
me.baseGui.Update(testRefresh)
+ if me.clock.tk != nil && !me.showHelp {
+ // also double check the gocui view exists
+ if me.clock.tk.v != nil {
+ me.clock.tk.v.Clear()
+ me.clock.tk.labelN = time.Now().Format("15:04:05")
+ me.clock.tk.v.WriteString(me.clock.tk.labelN)
+ }
+ }
} else {
// log.Info("refresh skip on mouseDown")
// me.baseGui.Update()