diff options
| author | Jeff Carr <[email protected]> | 2025-03-03 01:51:16 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-03 01:51:16 -0600 |
| commit | 65cf744a8643d63780fed3fc2f60cbe289f54cac (patch) | |
| tree | 0ac839eb1fa66a33788f260ddb30ea75d7a2e5ab /libnotify.go | |
| parent | caf7428ba314cdbc542630b6e4d6c311a99293cb (diff) | |
cleaner libnotifyUpdate()
Diffstat (limited to 'libnotify.go')
| -rw-r--r-- | libnotify.go | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/libnotify.go b/libnotify.go index 7cd68df..19be3c0 100644 --- a/libnotify.go +++ b/libnotify.go @@ -67,6 +67,39 @@ func makeClock(wId int) { me.notify.clock.tk.Show() me.notify.clock.active = true me.notify.clock.tk.dumpWidget("showClock()") + +} + +func libNotifyUpdate() { + if me.baseGui == nil { + log.Info("libNotifyUpdate error baseGui == nil") + return + } + + // refresh GOCUI + me.baseGui.Update(testRefresh) + // me.baseGui.UpdateAsync(testRefresh) // Async option. probably don't need this? + + if me.notify.clock.tk == nil { + log.Info("libNotifyUpdate error clock.tk == nil") + return + } + + // check for SIGWINCH. If so, move the libnotify clock + w, h := me.baseGui.Size() + if me.winchW != w || me.winchH != h { + log.Info("handle SIGWINCH!", w, h) + me.notify.clock.tk.MoveToOffset(w-15, 1) + me.notify.clock.tk.Hide() + me.notify.clock.tk.Show() + me.winchW = w + me.winchH = h + } + + // update the time + me.notify.clock.tk.v.Clear() + me.notify.clock.tk.labelN = time.Now().Format("15:04:05") + me.notify.clock.tk.v.WriteString(me.notify.clock.tk.labelN) } // in the very end of redrawing things, this will place the help and stdout on the top or botton |
