diff options
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 |
