diff options
| author | Jeff Carr <[email protected]> | 2025-02-08 13:28:19 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-02-08 13:28:19 -0600 |
| commit | c4f9bac85eeafb4916b57d6f8953fa930d6d098e (patch) | |
| tree | 065027c2d85165c2eb1c2ec14490b7b9a1dbf51c /help.go | |
| parent | 90083d5bcb2df4b526a04213c07392fe72cb816c (diff) | |
add config default to show stdout onscreen on start
Diffstat (limited to 'help.go')
| -rw-r--r-- | help.go | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -11,6 +11,7 @@ import ( "errors" "fmt" "strings" + "time" "github.com/awesome-gocui/gocui" log "go.wit.com/log" @@ -85,8 +86,13 @@ func showHelp() error { } g.SetViewOnTop("help") me.helpLabel = help + if me.clock.tk == nil { + makeClock() + me.clock.tk.MoveToOffset(maxX-10, 1) + me.clock.tk.Hide() + me.clock.tk.Show() + } if me.clock.tk != nil { - g.SetView("help", maxX-(newW+me.FramePadW), 0, maxX-1, len(helpText)+me.FramePadH, 0) me.clock.tk.MoveToOffset(maxX-10, 1) me.clock.tk.Hide() me.clock.tk.Show() @@ -94,6 +100,19 @@ func showHelp() error { return nil } +func makeClock() { + me.clock.tk = makeNewFlagWidget(me.clock.wId) + me.clock.tk.dumpWidget("init() clock") + w, h := me.baseGui.MousePosition() + me.clock.tk.MoveToOffset(w, h) + me.clock.tk.labelN = time.Now().Format("15:04:05") + me.clock.tk.frame = false + me.clock.tk.setColorLabel() + me.clock.tk.Show() + me.clock.active = true + me.clock.tk.dumpWidget("showClock()") +} + // in the very end of redrawing things, this will place the help and stdout on the top or botton // depending on the state the user has chosen func setThingsOnTop() { @@ -102,6 +121,9 @@ func setThingsOnTop() { } else { me.baseGui.SetViewOnTop("help") } + if me.clock.tk != nil { + me.baseGui.SetViewOnTop(me.clock.tk.v.Name()) + } if me.dark { me.stdout.tk.v.FgColor = gocui.ColorWhite @@ -116,6 +138,11 @@ func setThingsOnTop() { } else { me.baseGui.SetViewOnBottom("msg") } + if me.stdout.startOnscreen { + log.Info("attempting to locate stdout on screen for the first time") + me.stdout.tk.relocateStdout(me.stdout.lastW, me.stdout.lastH) + me.stdout.startOnscreen = false + } setBottomBG() } |
