summaryrefslogtreecommitdiff
path: root/init.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-08 12:05:25 -0600
committerJeff Carr <[email protected]>2025-02-08 12:05:25 -0600
commit665d2289e2ce910326cacb2e6b8c35c5e241c279 (patch)
tree01681b2e03c7a68cb122b3fae70e065d99142e1a /init.go
parented024aac7025cdf41d2ea6f0c5a83f1694982da1 (diff)
tiggers gocui on startup
Diffstat (limited to 'init.go')
-rw-r--r--init.go47
1 files changed, 46 insertions, 1 deletions
diff --git a/init.go b/init.go
index 3964ce0..d387d02 100644
--- a/init.go
+++ b/init.go
@@ -56,6 +56,7 @@ func init() {
me.myTree = tree.New()
me.myTree.PluginName = "gocui"
+ go refreshGocui()
if val, err := me.myTree.ConfigFind("dark"); err == nil {
if val == "true" {
@@ -207,6 +208,47 @@ func gocuiMain() {
}
}
+// this hack is to wait for the application to send something
+// before trying to do anything. todo: rethink this someday
+func waitOK() {
+ for {
+ if me.ok {
+ return
+ }
+ time.Sleep(10 * time.Millisecond)
+ }
+}
+
+var lastRefresh time.Time
+
+func testRefresh(*gocui.Gui) error {
+ log.Info("in testRefresh")
+ return nil
+}
+
+func refreshGocui() {
+ lastRefresh = time.Now()
+ for {
+ time.Sleep(10 * time.Millisecond)
+ // log.Info("refresh checking ok")
+ if !me.ok {
+ continue
+ }
+ if time.Since(lastRefresh) > 1*time.Second {
+ if me.mouse.mouseUp {
+ log.Info("refresh now on mouseUp")
+ me.baseGui.Update(testRefresh)
+ } else {
+ log.Info("refresh skip on mouseDown")
+ // me.baseGui.Update()
+ }
+ lastRefresh = time.Now()
+ }
+ }
+}
+
+// set the widget start width & height
+
func newWindowTrigger() {
log.Log(NOW, "newWindowTriggerl() START")
for {
@@ -222,7 +264,10 @@ func newWindowTrigger() {
relocateStdoutOffscreen()
}
tk.makeWindowActive()
- tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0)
+ // place the new window relative to the mouse
+ tk.redrawWindow(me.mouse.downW+8, me.mouse.downH-2)
+ // tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0)
+
setThingsOnTop() // sets help, Stdout, etc on the top after windows have been redrawn
// log.Log(NOW, "newWindowTrigger() after sleep")
}