From c16bb5b088ce71fd6d032228b505cb5e133fcb3c Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 7 Apr 2023 11:23:47 -0500 Subject: okay then Signed-off-by: Jeff Carr --- Makefile | 6 +++++- args.go | 1 + gui.go | 15 ++++++++++++--- main.go | 5 ++++- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index abd5360..1f721e2 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ run: build - ./control-panel-dns + ./control-panel-dns >/tmp/witgui.log.stderr 2>&1 install: go install -v go.wit.com/control-panel-dns@latest @@ -91,3 +91,7 @@ sudo-cp: go-get: go install -v check.lab.wit.org/gui + +log: + reset + tail -f /tmp/witgui.* /tmp/guilogfile diff --git a/args.go b/args.go index 41fe820..0206c5a 100644 --- a/args.go +++ b/args.go @@ -12,6 +12,7 @@ type LogOptions struct { VerboseDNS bool `arg:"--verbose-dns" help:"debug your dns settings"` LogFile string `help:"write all output to a file"` // User string `arg:"env:USER"` + Display string `arg:"env:DISPLAY"` } var args struct { diff --git a/gui.go b/gui.go index 05f52c4..8edb82a 100644 --- a/gui.go +++ b/gui.go @@ -2,6 +2,7 @@ package main import ( + "fmt" "os" "os/user" "strconv" @@ -12,8 +13,8 @@ import ( "github.com/davecgh/go-spew/spew" ) -// This initializes the first window -func initGUI() { +// This setups up the dns control panel window +func setupControlPanelWindow() { me.window = myGui.New2().Window("DNS and IPv6 Control Panel").Standard() me.window.Dump(true) @@ -36,6 +37,14 @@ func addDNSTab(title string) { g2.NewButton("gui.DebugWindow()", func () { gui.DebugWindow() }) + + g2.NewButton("Load 'gocui'", func () { + // this set the xterm and mate-terminal window title. maybe works generally? + fmt.Println("\033]0;" + title + "blah \007") + gui.StartS("gocui") + gui.Redraw("gocui") + }) + g2.NewButton("Network Interfaces", func () { for i, t := range me.ifmap { log("name =", t.iface.Name) @@ -106,7 +115,7 @@ func myDefaultExit(n *gui.Node) { func nsupdateGroup(w *gui.Node) { g := w.NewGroup("dns update") - grid := g.NewGrid("fucknuts", 2, 2) + grid := g.NewGrid("gridnuts", 2, 2) grid.SetNext(1,1) grid.NewLabel("hostname =") diff --git a/main.go b/main.go index 6eb15c3..5aedd51 100644 --- a/main.go +++ b/main.go @@ -42,7 +42,10 @@ func main() { // myGui = gui.Main(initGUI) myGui = gui.Start() sleep(1) - initGUI() + setupControlPanelWindow() + sleep(1) + myGui.LoadPlugin("gocui") + // gui.Redraw("gocui") sleep(1) checkNetworkChanges() } -- cgit v1.2.3