From b24cc5898604191df7bfc2cacd7bc5043fa14a42 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 8 Apr 2023 15:34:36 -0500 Subject: gocui: compiling and running again Signed-off-by: Jeff Carr --- toolkit/gocui/main.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'toolkit') diff --git a/toolkit/gocui/main.go b/toolkit/gocui/main.go index e2ec85f..f9611c1 100644 --- a/toolkit/gocui/main.go +++ b/toolkit/gocui/main.go @@ -50,6 +50,15 @@ func catchActionChannel() { log(logInfo, "catchActionChannel() infinite for() loop restarted select on channel") select { case a := <-me.pluginChan: + // this plugin can be loaded, but it doesn't actually do anything until + // the calling program sends an action to it. Then, it actually will initialize + // the tty and take over your console + if (me.baseGui == nil) { + log(logError,"main() was not run yet") + go main() + // probably not needed, but in here for now under development + sleep(1) + } log(logNow, "catchActionChannel()", a.WidgetId, a.ActionType, a.WidgetType, a.Name) action(&a) } @@ -61,8 +70,8 @@ func Exit() { me.baseGui.Close() } -func Main(f func()) { - log("start Init()") +func main() { + log(logInfo, "main() start Init()") outf, err := os.OpenFile("/tmp/witgui.log", os.O_RDWR | os.O_CREATE | os.O_APPEND, 0666) if err != nil { -- cgit v1.2.3