From fefa99920b0ae39f685f58a28f89bf2a24881f12 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 8 Feb 2025 06:34:51 -0600 Subject: global protobuf name conflict --- Makefile | 2 +- gocuiView.proto | 44 ++++++++++++++++++++++++++++++++++++++++++++ help.go | 2 +- init.go | 16 +++++++++++----- view.proto.new | 44 -------------------------------------------- 5 files changed, 57 insertions(+), 51 deletions(-) create mode 100644 gocuiView.proto delete mode 100644 view.proto.new diff --git a/Makefile b/Makefile index 11df1fb..1ae6757 100644 --- a/Makefile +++ b/Makefile @@ -49,5 +49,5 @@ redomod: GO111MODULE= go mod tidy proto: - autogenpb --proto view.proto + autogenpb --proto gocuiView.proto make goimports diff --git a/gocuiView.proto b/gocuiView.proto new file mode 100644 index 0000000..5dab35d --- /dev/null +++ b/gocuiView.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; + +// including this in a plugin seems to keep it from loading at this point + +package main; + +import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp + +// maybe put all the gocui specific stuff here. +message GocuiState { // `autogenpb:nomutex` + bool visible = 1; + bool internal = 2; + int64 w0 = 3; + int64 h0 = 4; + int64 w1 = 5; + int64 h1 = 6; +} + +message ViewSettings { // `autogenpb:nomutex` + bool pack = 1; + int64 framesize = 5; +} + +message Tree { + View parent = 1; + repeated View children = 2; + View node = 3; +} + +// this is the gocui 'view' in binary tree form +message GocuiView { + int64 widgetId = 3; // `autogenpb:unique` `autogenpb:sort` + string name = 4; // `autogenpb:unique` `autogenpb:sort` + GocuiState state = 7; +} + +message GocuiViews { // `autogenpb:marshal` `autogenpb:mutex` + string uuid = 1; // `autogenpb:uuid:d19c1fbb-32c2-4957-aee6-f8128a511dca` + string version = 2; // `autogenpb:version:v0.0.1` + repeated GocuiView GocuiViews = 3; + Tree tree = 4; + map junk = 5; + ViewSettings settings = 6; +} diff --git a/help.go b/help.go index 1948fa8..6a64bc4 100644 --- a/help.go +++ b/help.go @@ -25,7 +25,7 @@ import ( var helpText []string = []string{"Help Menu", "", - "H: toggle (H)elp", + "H: toggle z(H)elp", "D: toggle light/dark mode", "Tab: toggle through windows", "q: quit()", diff --git a/init.go b/init.go index a53076f..7545da0 100644 --- a/init.go +++ b/init.go @@ -50,16 +50,22 @@ func init() { me.textbox.wId = -55 me.stdout.wId = -4 - // macos iterm2 really only works with dark mode right now - if runtime.GOOS == "macos" { - me.dark = true - } - // Set(&me, "dense") me.myTree = tree.New() me.myTree.PluginName = "gocui" + if val, err := me.myTree.ConfigFind("dark"); err == nil { + if val == "true" { + me.dark = true + } + } else { + // macos iterm2 really only works with dark mode right now + if runtime.GOOS == "macos" { + me.dark = true + } + } + me.myTree.NodeAction = newaction me.myTree.Add = newAdd me.myTree.SetTitle = newSetTitle diff --git a/view.proto.new b/view.proto.new deleted file mode 100644 index dd2f708..0000000 --- a/view.proto.new +++ /dev/null @@ -1,44 +0,0 @@ -syntax = "proto3"; - -// including this in a plugin seems to keep it from loading at this point - -package main; - -import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp - -// maybe put all the gocui specific stuff here. -message GocuiState { // `autogenpb:nomutex` - bool visible = 1; - bool internal = 2; - int64 w0 = 3; - int64 h0 = 4; - int64 w1 = 5; - int64 h1 = 6; -} - -message ViewSettings { // `autogenpb:nomutex` - bool pack = 1; - int64 framesize = 5; -} - -message Tree { - View parent = 1; - repeated View children = 2; - View node = 3; -} - -// this is the gocui 'view' in binary tree form -message View { - int64 widgetId = 3; // `autogenpb:unique` `autogenpb:sort` - string name = 4; // `autogenpb:unique` `autogenpb:sort` - GocuiState state = 7; -} - -message Views { // `autogenpb:marshal` `autogenpb:mutex` - string uuid = 1; // `autogenpb:uuid:d19c1fbb-32c2-4957-aee6-f8128a511dca` - string version = 2; // `autogenpb:version:v0.0.1` - repeated View Views = 3; - Tree tree = 4; - map junk = 5; - ViewSettings settings = 6; -} -- cgit v1.2.3