Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
|
4f68cad59d | |
|
a8448512d4 | |
|
9bdc3fcd03 | |
|
d0e1ab2f8e |
|
@ -1 +1,4 @@
|
||||||
|
*.swp
|
||||||
|
go.mod
|
||||||
|
go.sum
|
||||||
wit-debian-gui
|
wit-debian-gui
|
||||||
|
|
6
Makefile
6
Makefile
|
@ -8,11 +8,15 @@ VERSION = $(shell cat resources/VERSION)
|
||||||
run: build
|
run: build
|
||||||
./wit-debian-gui
|
./wit-debian-gui
|
||||||
|
|
||||||
|
redomod:
|
||||||
|
rm -f go.*
|
||||||
|
go mod init
|
||||||
|
go mod tidy
|
||||||
|
|
||||||
new-build:
|
new-build:
|
||||||
# go mod edit -replace go.wit.com/wit/gui=/home/jcarr/go/src/git.wit.org/wit/gui
|
# go mod edit -replace go.wit.com/wit/gui=/home/jcarr/go/src/git.wit.org/wit/gui
|
||||||
# go mod edit -replace go.wit.com/wit/shell=/home/jcarr/go/src/git.wit.org/wit/shell
|
# go mod edit -replace go.wit.com/wit/shell=/home/jcarr/go/src/git.wit.org/wit/shell
|
||||||
# to update go.mod to master:
|
# to update go.mod to master:
|
||||||
# go get go.wit.com/gui/gui@master
|
|
||||||
go install -ldflags " \
|
go install -ldflags " \
|
||||||
-X main.GITCOMMIT=${GITCOMMIT} \
|
-X main.GITCOMMIT=${GITCOMMIT} \
|
||||||
-X main.GOVERSION='${GOVERSION}' \
|
-X main.GOVERSION='${GOVERSION}' \
|
||||||
|
|
25
apt.go
25
apt.go
|
@ -1,23 +1,22 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"go.wit.com/gui"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/gui"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func aptGroup(box *gui.Node) {
|
func aptGroup(box *gui.Node) {
|
||||||
n := box.NewGroup("apt Resets")
|
n := box.NewGroup("apt Resets")
|
||||||
|
|
||||||
n.NewButton("update apt-file", func () {
|
n.NewButton("update apt-file", func() {
|
||||||
// shell.Script("apt -y install apt-file\napt-file update")
|
// shell.Script("apt -y install apt-file\napt-file update")
|
||||||
// xterm("apt -y install apt-file; apt-file update")
|
// xterm("apt -y install apt-file; apt-file update")
|
||||||
// gui.ErrorWindow("test error window", "this is the error")
|
// gui.ErrorWindow("test error window", "this is the error")
|
||||||
err := sudo( func() error {
|
err := sudo(func() error {
|
||||||
err := bash("apt install moon-buggy")
|
err := bash("apt install moon-buggy")
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
if (err != nil) {
|
if err != nil {
|
||||||
log.Warn("Error", "Failed to run:\napt install moon-buggy")
|
log.Warn("Error", "Failed to run:\napt install moon-buggy")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -26,28 +25,28 @@ func aptGroup(box *gui.Node) {
|
||||||
bash("apt-file update")
|
bash("apt-file update")
|
||||||
})
|
})
|
||||||
|
|
||||||
n.NewButton("install packages", func () {
|
n.NewButton("install packages", func() {
|
||||||
aptPackagesWindow()
|
aptPackagesWindow()
|
||||||
})
|
})
|
||||||
|
|
||||||
n.NewButton("install base packages", func () {
|
n.NewButton("install base packages", func() {
|
||||||
sudo( func() error {
|
sudo(func() error {
|
||||||
line := "apt install moon-buggy2"
|
line := "apt install moon-buggy2"
|
||||||
err := bash(line)
|
err := bash(line)
|
||||||
if (err != nil) {
|
if err != nil {
|
||||||
log.Error(err, "Error", "Failed to run:\n" + line)
|
log.Error(err, "Error", "Failed to run:\n"+line)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
n.NewButton("purge rc-only", func () {
|
n.NewButton("purge rc-only", func() {
|
||||||
xterm("dpkg -l |grep ^rc | awk '{print $2}' |xargs apt remove --purge -y")
|
xterm("dpkg -l |grep ^rc | awk '{print $2}' |xargs apt remove --purge -y")
|
||||||
})
|
})
|
||||||
n.NewButton("install defaults", func () {
|
n.NewButton("install defaults", func() {
|
||||||
xterm("./resources/bin/setup-packages-default")
|
xterm("./resources/bin/setup-packages-default")
|
||||||
})
|
})
|
||||||
n.NewButton("install kvm", func () {
|
n.NewButton("install kvm", func() {
|
||||||
xterm("./resources/bin/setup-packages-kvm")
|
xterm("./resources/bin/setup-packages-kvm")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "log"
|
import "log"
|
||||||
|
|
||||||
// import "os"
|
// import "os"
|
||||||
|
|
||||||
import "go.wit.com/gui/gui"
|
import "go.wit.com/gui"
|
||||||
|
|
||||||
// import "github.com/skratchdot/open-golang/open"
|
// import "github.com/skratchdot/open-golang/open"
|
||||||
// import "github.com/davecgh/go-spew/spew"
|
// import "github.com/davecgh/go-spew/spew"
|
||||||
|
|
||||||
|
@ -14,33 +16,33 @@ import "go.wit.com/gui/gui"
|
||||||
//
|
//
|
||||||
|
|
||||||
type myButtonInfo struct {
|
type myButtonInfo struct {
|
||||||
Custom func (*gui.Node)
|
Custom func(*gui.Node)
|
||||||
ADD func (*gui.Node)
|
ADD func(*gui.Node)
|
||||||
Name string
|
Name string
|
||||||
Action string
|
Action string
|
||||||
Node *gui.Node
|
Node *gui.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
// stores the fields we want to map into our private structure 'values'
|
// stores the fields we want to map into our private structure 'values'
|
||||||
func makeButtonValues(n *gui.Node, name string, action string, custom func(*gui.Node)) *myButtonInfo {
|
func makeButtonValues(n *gui.Node, name string, action string, custom func(*gui.Node)) *myButtonInfo {
|
||||||
val := &myButtonInfo{}
|
val := &myButtonInfo{}
|
||||||
val.Custom = custom
|
val.Custom = custom
|
||||||
val.Name = name
|
val.Name = name
|
||||||
// val.Action = action
|
// val.Action = action
|
||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
// stores the fields we want to map into our private structure 'values'
|
// stores the fields we want to map into our private structure 'values'
|
||||||
func newMmakeButtonValues(name string, custom func(*gui.Node)) *myButtonInfo {
|
func newMmakeButtonValues(name string, custom func(*gui.Node)) *myButtonInfo {
|
||||||
val := &myButtonInfo{}
|
val := &myButtonInfo{}
|
||||||
val.Custom = custom
|
val.Custom = custom
|
||||||
val.Name = name
|
val.Name = name
|
||||||
// val.Action = action
|
// val.Action = action
|
||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeXtermButton(n *gui.Node, name string, action string, custom string) *gui.Node {
|
func makeXtermButton(n *gui.Node, name string, action string, custom string) *gui.Node {
|
||||||
n.NewButton(name, func () {
|
n.NewButton(name, func() {
|
||||||
log.Println("xterm cmd=", custom)
|
log.Println("xterm cmd=", custom)
|
||||||
xterm(custom)
|
xterm(custom)
|
||||||
})
|
})
|
||||||
|
|
8
main.go
8
main.go
|
@ -4,10 +4,10 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.wit.com/log"
|
|
||||||
"go.wit.com/gui/gui"
|
|
||||||
"go.wit.com/gui/gadgets"
|
|
||||||
"github.com/gobuffalo/packr"
|
"github.com/gobuffalo/packr"
|
||||||
|
"go.wit.com/gui"
|
||||||
|
"go.wit.com/lib/gadgets"
|
||||||
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
// origlog "log"
|
// origlog "log"
|
||||||
|
@ -67,7 +67,7 @@ func main() {
|
||||||
myGui = gui.New().Default()
|
myGui = gui.New().Default()
|
||||||
|
|
||||||
log.Warn("Starting window")
|
log.Warn("Starting window")
|
||||||
gadgets.NewBasicWindow(myGui, "Debian SID Mate Control Panel " + VERSION)
|
gadgets.NewBasicWindow(myGui, "Debian SID Mate Control Panel "+VERSION)
|
||||||
|
|
||||||
tabResets()
|
tabResets()
|
||||||
windowAddWWW()
|
windowAddWWW()
|
||||||
|
|
27
os.go
27
os.go
|
@ -1,22 +1,21 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"bufio"
|
||||||
|
"errors"
|
||||||
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"io/ioutil"
|
"strings"
|
||||||
"errors"
|
|
||||||
"bufio"
|
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
// "go.wit.com/gui/gui"
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
)
|
)
|
||||||
|
|
||||||
func runSimpleCommand(s string) {
|
func runSimpleCommand(s string) {
|
||||||
cmd := strings.TrimSpace(s) // this is like 'chomp' in perl
|
cmd := strings.TrimSpace(s) // this is like 'chomp' in perl
|
||||||
cmd = strings.TrimSuffix(cmd, "\n") // this is like 'chomp' in perl
|
cmd = strings.TrimSuffix(cmd, "\n") // this is like 'chomp' in perl
|
||||||
cmdArgs := strings.Fields(cmd)
|
cmdArgs := strings.Fields(cmd)
|
||||||
runLinuxCommand(cmdArgs)
|
runLinuxCommand(cmdArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,12 +111,12 @@ func packrSaveFile(packrname string, filename string) error {
|
||||||
func bash(cmdline string) error {
|
func bash(cmdline string) error {
|
||||||
log.Println("shell.Run() START " + cmdline)
|
log.Println("shell.Run() START " + cmdline)
|
||||||
|
|
||||||
cmdArgs := strings.Fields(cmdline)
|
cmdArgs := strings.Fields(cmdline)
|
||||||
|
|
||||||
process := exec.Command(cmdArgs[0], cmdArgs[1:len(cmdArgs)]...)
|
process := exec.Command(cmdArgs[0], cmdArgs[1:len(cmdArgs)]...)
|
||||||
process.Stderr = os.Stderr
|
process.Stderr = os.Stderr
|
||||||
process.Stdin = os.Stdin
|
process.Stdin = os.Stdin
|
||||||
process.Stdout = os.Stdout
|
process.Stdout = os.Stdout
|
||||||
process.Start()
|
process.Start()
|
||||||
err := process.Wait()
|
err := process.Wait()
|
||||||
log.Println("shell.Exec() err =", err)
|
log.Println("shell.Exec() err =", err)
|
||||||
|
@ -129,7 +128,7 @@ func sudo(f func() error) error {
|
||||||
uid := os.Getuid()
|
uid := os.Getuid()
|
||||||
e := "You must be root to do this."
|
e := "You must be root to do this."
|
||||||
log.Println(e, "uid =", uid)
|
log.Println(e, "uid =", uid)
|
||||||
if (uid != 0) {
|
if uid != 0 {
|
||||||
log.Warn("Permissions Failed", e)
|
log.Warn("Permissions Failed", e)
|
||||||
return errors.New("not root")
|
return errors.New("not root")
|
||||||
}
|
}
|
||||||
|
|
17
systray.go
17
systray.go
|
@ -2,17 +2,14 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
// "go.wit.com/gui/gui"
|
|
||||||
"go.wit.com/gui/debugger"
|
|
||||||
"github.com/davecgh/go-spew/spew"
|
"github.com/davecgh/go-spew/spew"
|
||||||
"github.com/getlantern/systray"
|
"github.com/getlantern/systray"
|
||||||
|
"go.wit.com/lib/debugger"
|
||||||
// "github.com/skratchdot/open-golang/open"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func systrayMain() {
|
func systrayMain() {
|
||||||
|
@ -103,11 +100,11 @@ func onReady() {
|
||||||
case <-mHide.ClickedCh:
|
case <-mHide.ClickedCh:
|
||||||
log.Println("START Hide()")
|
log.Println("START Hide()")
|
||||||
/*
|
/*
|
||||||
window := gui.Data.WindowMap["splash"]
|
window := gui.Data.WindowMap["splash"]
|
||||||
if window != nil {
|
if window != nil {
|
||||||
box := window.BoxMap["splash"]
|
box := window.BoxMap["splash"]
|
||||||
box.Window.UiTab.Hide()
|
box.Window.UiTab.Hide()
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
log.Println("END")
|
log.Println("END")
|
||||||
case <-mEnabled.ClickedCh:
|
case <-mEnabled.ClickedCh:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
//go:build darwin || freebsd || dragonfly || openbsd || netbsd
|
||||||
// +build darwin freebsd dragonfly openbsd netbsd
|
// +build darwin freebsd dragonfly openbsd netbsd
|
||||||
|
|
||||||
// https://github.com/creack/termios/blob/master/raw/tioc_bsd.go
|
// https://github.com/creack/termios/blob/master/raw/tioc_bsd.go
|
||||||
|
|
32
watch.go
32
watch.go
|
@ -9,8 +9,6 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
// "go.wit.com/gui/gui"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type myChan struct {
|
type myChan struct {
|
||||||
|
@ -30,26 +28,26 @@ func watchWindows() {
|
||||||
log.Println("Window was closed")
|
log.Println("Window was closed")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if dnsSlider == nil {
|
if dnsSlider == nil {
|
||||||
log.Println("SKIPPING: dnsSlider == nil")
|
log.Println("SKIPPING: dnsSlider == nil")
|
||||||
} else {
|
} else {
|
||||||
dnsSlider.SetValue(55)
|
dnsSlider.SetValue(55)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
// gui.CreateWindow("ARGV", "vars", 300, 200, makeWindowARGV)
|
// gui.CreateWindow("ARGV", "vars", 300, 200, makeWindowARGV)
|
||||||
|
|
||||||
debug.PrintStack()
|
debug.PrintStack()
|
||||||
dumpModuleInfo()
|
dumpModuleInfo()
|
||||||
/*
|
/*
|
||||||
gui.DumpBoxes()
|
gui.DumpBoxes()
|
||||||
window := gui.Data.WindowMap["Debugging2"]
|
window := gui.Data.WindowMap["Debugging2"]
|
||||||
if window != nil {
|
if window != nil {
|
||||||
log.Println("found debugging2 Window")
|
log.Println("found debugging2 Window")
|
||||||
gui.DeleteWindow("Debugging2")
|
gui.DeleteWindow("Debugging2")
|
||||||
} else {
|
} else {
|
||||||
closed = false
|
closed = false
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// toggle the systray menu
|
// toggle the systray menu
|
||||||
var tmp struct{}
|
var tmp struct{}
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
// "bufio"
|
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
|
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
// "go.wit.com/gui/gui"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/gui/gadgets"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var langWin *gadgets.BasicWindow
|
var langWin *gadgets.BasicWindow
|
||||||
|
@ -24,44 +22,44 @@ func golangDebug() {
|
||||||
/////////////////////////////// Column DEBUG GOLANG //////////////////////
|
/////////////////////////////// Column DEBUG GOLANG //////////////////////
|
||||||
gNode := langWin.Box().NewGroup("golang")
|
gNode := langWin.Box().NewGroup("golang")
|
||||||
|
|
||||||
gNode.NewButton("runtime.Stack() dump", func () {
|
gNode.NewButton("runtime.Stack() dump", func() {
|
||||||
log.Println("\tSTART")
|
log.Println("\tSTART")
|
||||||
buf := make([]byte, 1<<16)
|
buf := make([]byte, 1<<16)
|
||||||
runtime.Stack(buf, true)
|
runtime.Stack(buf, true)
|
||||||
log.Printf("%s", buf)
|
log.Printf("%s", buf)
|
||||||
log.Println("\tEND")
|
log.Println("\tEND")
|
||||||
})
|
})
|
||||||
gNode.NewButton("dumpModuleInfo", func () {
|
gNode.NewButton("dumpModuleInfo", func() {
|
||||||
log.Println("\tSTART")
|
log.Println("\tSTART")
|
||||||
dumpModuleInfo()
|
dumpModuleInfo()
|
||||||
log.Println("\tEND")
|
log.Println("\tEND")
|
||||||
})
|
})
|
||||||
gNode.NewButton("debug.PrintStack", func () {
|
gNode.NewButton("debug.PrintStack", func() {
|
||||||
log.Println("\tSTART")
|
log.Println("\tSTART")
|
||||||
debug.PrintStack()
|
debug.PrintStack()
|
||||||
log.Println("\tEND")
|
log.Println("\tEND")
|
||||||
})
|
})
|
||||||
gNode.NewButton("pprof.Lookup goroutine", func () {
|
gNode.NewButton("pprof.Lookup goroutine", func() {
|
||||||
log.Println("\tSTART")
|
log.Println("\tSTART")
|
||||||
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
|
pprof.Lookup("goroutine").WriteTo(os.Stdout, 1)
|
||||||
log.Println("\tEND")
|
log.Println("\tEND")
|
||||||
})
|
})
|
||||||
gNode.NewButton("pprof.Lookup", func () {
|
gNode.NewButton("pprof.Lookup", func() {
|
||||||
log.Println("\tSTART")
|
log.Println("\tSTART")
|
||||||
pprof.Lookup("heap").WriteTo(os.Stdout, 1)
|
pprof.Lookup("heap").WriteTo(os.Stdout, 1)
|
||||||
log.Println("\tEND")
|
log.Println("\tEND")
|
||||||
})
|
})
|
||||||
gNode.NewButton("pprof.Lookup block", func () {
|
gNode.NewButton("pprof.Lookup block", func() {
|
||||||
log.Println("\tSTART")
|
log.Println("\tSTART")
|
||||||
pprof.Lookup("block").WriteTo(os.Stdout, 1)
|
pprof.Lookup("block").WriteTo(os.Stdout, 1)
|
||||||
log.Println("\tEND")
|
log.Println("\tEND")
|
||||||
})
|
})
|
||||||
gNode.NewButton("pprof.Lookup threadcreate", func () {
|
gNode.NewButton("pprof.Lookup threadcreate", func() {
|
||||||
log.Println("\tSTART")
|
log.Println("\tSTART")
|
||||||
pprof.Lookup("threadcreate").WriteTo(os.Stdout, 1)
|
pprof.Lookup("threadcreate").WriteTo(os.Stdout, 1)
|
||||||
log.Println("\tEND")
|
log.Println("\tEND")
|
||||||
})
|
})
|
||||||
gNode.NewButton("runtime.ReadMemStats", func () {
|
gNode.NewButton("runtime.ReadMemStats", func() {
|
||||||
var s runtime.MemStats
|
var s runtime.MemStats
|
||||||
runtime.ReadMemStats(&s)
|
runtime.ReadMemStats(&s)
|
||||||
log.Printf("alloc: %v bytes\n", s.Alloc)
|
log.Printf("alloc: %v bytes\n", s.Alloc)
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"go.wit.com/gui/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
var upDNSwin *gadgets.BasicWindow
|
var upDNSwin *gadgets.BasicWindow
|
||||||
|
|
||||||
func updateDNS(w *gui.Node) {
|
func updateDNS(w *gui.Node) {
|
||||||
if (upDNSwin != nil) {
|
if upDNSwin != nil {
|
||||||
upDNSwin.Toggle()
|
upDNSwin.Toggle()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
upDNSwin = gadgets.NewBasicWindow(w, "dns update Window")
|
upDNSwin = gadgets.NewBasicWindow(w, "dns update Window")
|
||||||
|
|
||||||
////////////// filename /////////////////////////
|
////////////// filename /////////////////////////
|
||||||
gNode := upDNSwin.Box().NewGroup("eth0 update")
|
gNode := upDNSwin.Box().NewGroup("eth0 update")
|
||||||
// fontsize := "16"
|
// fontsize := "16"
|
||||||
|
|
||||||
|
@ -25,9 +25,9 @@ func updateDNS(w *gui.Node) {
|
||||||
dnsNode.AddText("24")
|
dnsNode.AddText("24")
|
||||||
dnsNode.SetText("12")
|
dnsNode.SetText("12")
|
||||||
|
|
||||||
////////////// connect /////////////////////////
|
////////////// connect /////////////////////////
|
||||||
gNode = upDNSwin.Box().NewGroup("Update")
|
gNode = upDNSwin.Box().NewGroup("Update")
|
||||||
|
|
||||||
gNode.NewButton("setup .Xresources", func () {
|
gNode.NewButton("setup .Xresources", func() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"go.wit.com/gui/gui"
|
"go.wit.com/gui"
|
||||||
"go.wit.com/gui/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
)
|
)
|
||||||
|
|
||||||
var aptWin *gadgets.BasicWindow
|
var aptWin *gadgets.BasicWindow
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/gadgets"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var tabWin *gadgets.BasicWindow
|
var tabWin *gadgets.BasicWindow
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
|
||||||
"bufio"
|
"bufio"
|
||||||
"strings"
|
|
||||||
"errors"
|
"errors"
|
||||||
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"go.wit.com/gui"
|
||||||
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/gui"
|
|
||||||
"go.wit.com/gui/gadgets"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var filename string = "resolv-1-1-1-1.conf"
|
var filename string = "resolv-1-1-1-1.conf"
|
||||||
|
@ -17,13 +17,13 @@ var generaloutput *gui.Node
|
||||||
var resWin *gadgets.BasicWindow
|
var resWin *gadgets.BasicWindow
|
||||||
|
|
||||||
func resolvWindow() {
|
func resolvWindow() {
|
||||||
if (resWin != nil) {
|
if resWin != nil {
|
||||||
resWin.Toggle()
|
resWin.Toggle()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
resWin = gadgets.NewBasicWindow(myGui,"resolv.conf Window")
|
resWin = gadgets.NewBasicWindow(myGui, "resolv.conf Window")
|
||||||
|
|
||||||
////////////// filename /////////////////////////
|
////////////// filename /////////////////////////
|
||||||
gNode := resWin.Box().NewGroup("filename")
|
gNode := resWin.Box().NewGroup("filename")
|
||||||
|
|
||||||
var tmp []string
|
var tmp []string
|
||||||
|
@ -41,22 +41,22 @@ func resolvWindow() {
|
||||||
}
|
}
|
||||||
|
|
||||||
resolvNode.SetText(filename)
|
resolvNode.SetText(filename)
|
||||||
resolvNode.Custom = func () {
|
resolvNode.Custom = func() {
|
||||||
log.Println("STARTED HOSTNAME")
|
log.Println("STARTED HOSTNAME")
|
||||||
filename = resolvNode.GetText()
|
filename = resolvNode.GetText()
|
||||||
b, _ := packrBox.FindString(filename)
|
b, _ := packrBox.FindString(filename)
|
||||||
if (generaloutput != nil) {
|
if generaloutput != nil {
|
||||||
generaloutput.SetText(b)
|
generaloutput.SetText(b)
|
||||||
}
|
}
|
||||||
log.Println("ENDED GetText() HOSTNAME =", filename)
|
log.Println("ENDED GetText() HOSTNAME =", filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////// connect /////////////////////////
|
////////////// connect /////////////////////////
|
||||||
gNode = resWin.Box().NewGroup("")
|
gNode = resWin.Box().NewGroup("")
|
||||||
|
|
||||||
gNode.NewButton("Update /etc/resolv.conf", func () {
|
gNode.NewButton("Update /etc/resolv.conf", func() {
|
||||||
sudo( func() error {
|
sudo(func() error {
|
||||||
log.Println("set resolv.conf to",filename)
|
log.Println("set resolv.conf to", filename)
|
||||||
b, _ := packrBox.FindString(filename)
|
b, _ := packrBox.FindString(filename)
|
||||||
// spew.Dump(b)
|
// spew.Dump(b)
|
||||||
b = generaloutput.GetText()
|
b = generaloutput.GetText()
|
||||||
|
@ -75,22 +75,22 @@ func resolvWindow() {
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
gNode.NewButton("test ping ipv4", func () {
|
gNode.NewButton("test ping ipv4", func() {
|
||||||
bash("ping -c 3 -4 google.com")
|
bash("ping -c 3 -4 google.com")
|
||||||
})
|
})
|
||||||
gNode.NewButton("test ping ipv6", func () {
|
gNode.NewButton("test ping ipv6", func() {
|
||||||
bash("ping -c 3 -6 google.com")
|
bash("ping -c 3 -6 google.com")
|
||||||
})
|
})
|
||||||
|
|
||||||
gNode.NewButton("set output", func () {
|
gNode.NewButton("set output", func() {
|
||||||
if (generaloutput != nil) {
|
if generaloutput != nil {
|
||||||
generaloutput.SetText("wow")
|
generaloutput.SetText("wow")
|
||||||
generaloutput.Margin()
|
generaloutput.Margin()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
gNode = resWin.Box().NewGroup("Update")
|
gNode = resWin.Box().NewGroup("Update")
|
||||||
gNode.NewButton("MakeGroupEdit()", func () {
|
gNode.NewButton("MakeGroupEdit()", func() {
|
||||||
log.Warn("recreate a gadget for editing the resolv.conf")
|
log.Warn("recreate a gadget for editing the resolv.conf")
|
||||||
//generaloutput = gNode.MakeGroupEdit("resolv.conf:")
|
//generaloutput = gNode.MakeGroupEdit("resolv.conf:")
|
||||||
})
|
})
|
||||||
|
|
|
@ -3,22 +3,22 @@ package main
|
||||||
import (
|
import (
|
||||||
"os/user"
|
"os/user"
|
||||||
|
|
||||||
|
"go.wit.com/gui"
|
||||||
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/gui"
|
|
||||||
"go.wit.com/gui/gadgets"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var userNode *gui.Node
|
var userNode *gui.Node
|
||||||
var sshWin *gadgets.BasicWindow
|
var sshWin *gadgets.BasicWindow
|
||||||
|
|
||||||
func sshGenericWindow() {
|
func sshGenericWindow() {
|
||||||
if (sshWin != nil) {
|
if sshWin != nil {
|
||||||
sshWin.Toggle()
|
sshWin.Toggle()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sshWin = gadgets.NewBasicWindow(myGui, "sshWindow")
|
sshWin = gadgets.NewBasicWindow(myGui, "sshWindow")
|
||||||
|
|
||||||
////////////// username /////////////////////////
|
////////////// username /////////////////////////
|
||||||
gNode := sshWin.Box().NewGroup("username")
|
gNode := sshWin.Box().NewGroup("username")
|
||||||
|
|
||||||
userNode = gNode.NewCombobox("username")
|
userNode = gNode.NewCombobox("username")
|
||||||
|
@ -26,7 +26,7 @@ func sshGenericWindow() {
|
||||||
userNode.AddText("jcarr")
|
userNode.AddText("jcarr")
|
||||||
userNode.AddText("hugo")
|
userNode.AddText("hugo")
|
||||||
|
|
||||||
userNode.Custom = func () {
|
userNode.Custom = func() {
|
||||||
username = userNode.GetText()
|
username = userNode.GetText()
|
||||||
log.Println("SETTING: username=", username)
|
log.Println("SETTING: username=", username)
|
||||||
userNode.Dump()
|
userNode.Dump()
|
||||||
|
@ -38,7 +38,7 @@ func sshGenericWindow() {
|
||||||
userNode.Dump()
|
userNode.Dump()
|
||||||
// panic("blah")
|
// panic("blah")
|
||||||
|
|
||||||
////////////// hostname /////////////////////////
|
////////////// hostname /////////////////////////
|
||||||
gNode = sshWin.Box().NewGroup("homename")
|
gNode = sshWin.Box().NewGroup("homename")
|
||||||
|
|
||||||
hostNode := gNode.NewCombobox("hostname")
|
hostNode := gNode.NewCombobox("hostname")
|
||||||
|
@ -46,7 +46,7 @@ func sshGenericWindow() {
|
||||||
hostNode.AddText("mirrors")
|
hostNode.AddText("mirrors")
|
||||||
hostNode.AddText("git")
|
hostNode.AddText("git")
|
||||||
|
|
||||||
hostNode.Custom = func () {
|
hostNode.Custom = func() {
|
||||||
log.Println("STARTED HOSTNAME")
|
log.Println("STARTED HOSTNAME")
|
||||||
hostname = hostNode.GetText()
|
hostname = hostNode.GetText()
|
||||||
log.Println("ENDED GetText() HOSTNAME")
|
log.Println("ENDED GetText() HOSTNAME")
|
||||||
|
@ -54,10 +54,10 @@ func sshGenericWindow() {
|
||||||
hostname = "mirrors"
|
hostname = "mirrors"
|
||||||
hostNode.SetText("mirrors")
|
hostNode.SetText("mirrors")
|
||||||
|
|
||||||
////////////// connect /////////////////////////
|
////////////// connect /////////////////////////
|
||||||
gNode = sshWin.Box().NewGroup("connect")
|
gNode = sshWin.Box().NewGroup("connect")
|
||||||
|
|
||||||
gNode.NewButton("connect", func () {
|
gNode.NewButton("connect", func() {
|
||||||
cmd := "ssh -v " + username + "@" + hostname
|
cmd := "ssh -v " + username + "@" + hostname
|
||||||
log.Println("xterm cmd=", cmd)
|
log.Println("xterm cmd=", cmd)
|
||||||
xterm(cmd)
|
xterm(cmd)
|
||||||
|
|
|
@ -1,31 +1,31 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"go.wit.com/gui"
|
||||||
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/gui"
|
|
||||||
"go.wit.com/gui/gadgets"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var webWin *gadgets.BasicWindow
|
var webWin *gadgets.BasicWindow
|
||||||
|
|
||||||
func windowAddWWW() {
|
func windowAddWWW() {
|
||||||
if (webWin != nil) {
|
if webWin != nil {
|
||||||
webWin.Toggle()
|
webWin.Toggle()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
webWin = gadgets.NewBasicWindow(myGui, "webpages")
|
webWin = gadgets.NewBasicWindow(myGui, "webpages")
|
||||||
|
|
||||||
////////////// connect /////////////////////////
|
////////////// connect /////////////////////////
|
||||||
gNode := webWin.Box().NewGroup("www")
|
gNode := webWin.Box().NewGroup("www")
|
||||||
firefoxButton(gNode, "git", "https://git.wit.org/")
|
firefoxButton(gNode, "git", "https://git.wit.org/")
|
||||||
firefoxButton(gNode, "mirrors", "https://mirrors.wit.org/")
|
firefoxButton(gNode, "mirrors", "https://mirrors.wit.org/")
|
||||||
firefoxButton(gNode, "IPv6-Only ping", "http://ping.wit.org/")
|
firefoxButton(gNode, "IPv6-Only ping", "http://ping.wit.org/")
|
||||||
firefoxButton(gNode, "SyncThing", "http://localhost:8384/")
|
firefoxButton(gNode, "SyncThing", "http://localhost:8384/")
|
||||||
firefoxButton(gNode, "pprof this GO app", "http://localhost:6060/debug/pprof/")
|
firefoxButton(gNode, "pprof this GO app", "http://localhost:6060/debug/pprof/")
|
||||||
}
|
}
|
||||||
|
|
||||||
func firefoxButton (n *gui.Node, name string, url string) {
|
func firefoxButton(n *gui.Node, name string, url string) {
|
||||||
n.NewButton(name, func () {
|
n.NewButton(name, func() {
|
||||||
log.Println("button clicked: trying to open url")
|
log.Println("button clicked: trying to open url")
|
||||||
var tmp []string
|
var tmp []string
|
||||||
tmp = append(tmp, "nohup")
|
tmp = append(tmp, "nohup")
|
||||||
|
|
|
@ -3,9 +3,9 @@ package main
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
|
"go.wit.com/gui"
|
||||||
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
"go.wit.com/gui/gui"
|
|
||||||
"go.wit.com/gui/gadgets"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var fontNode *gui.Node
|
var fontNode *gui.Node
|
||||||
|
@ -14,7 +14,7 @@ var fontsize string = ""
|
||||||
var xtermWin *gadgets.BasicWindow
|
var xtermWin *gadgets.BasicWindow
|
||||||
|
|
||||||
func xtermSettings(w *gui.Node) {
|
func xtermSettings(w *gui.Node) {
|
||||||
if (xtermWin != nil) {
|
if xtermWin != nil {
|
||||||
xtermWin.Toggle()
|
xtermWin.Toggle()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -29,15 +29,15 @@ func xtermSettings(w *gui.Node) {
|
||||||
fontNode.AddText("16")
|
fontNode.AddText("16")
|
||||||
fontNode.AddText("24")
|
fontNode.AddText("24")
|
||||||
fontNode.AddText("32")
|
fontNode.AddText("32")
|
||||||
fontNode.Custom = func () {
|
fontNode.Custom = func() {
|
||||||
fontsize = fontNode.GetText()
|
fontsize = fontNode.GetText()
|
||||||
}
|
}
|
||||||
fontNode.SetText(fontsize)
|
fontNode.SetText(fontsize)
|
||||||
|
|
||||||
////////////// connect /////////////////////////
|
////////////// connect /////////////////////////
|
||||||
gNode = xtermWin.Box().NewGroup("Update")
|
gNode = xtermWin.Box().NewGroup("Update")
|
||||||
|
|
||||||
gNode.NewButton("setup .Xresources", func () {
|
gNode.NewButton("setup .Xresources", func() {
|
||||||
log.Println("fontsize =", fontsize)
|
log.Println("fontsize =", fontsize)
|
||||||
|
|
||||||
// write out .Xresources file
|
// write out .Xresources file
|
||||||
|
@ -52,13 +52,13 @@ func xtermSettings(w *gui.Node) {
|
||||||
log.Println("button click end")
|
log.Println("button click end")
|
||||||
})
|
})
|
||||||
|
|
||||||
gNode.NewButton("test xterm", func () {
|
gNode.NewButton("test xterm", func() {
|
||||||
cmd := "xterm"
|
cmd := "xterm"
|
||||||
xterm(cmd)
|
xterm(cmd)
|
||||||
})
|
})
|
||||||
|
|
||||||
gNode.NewButton("fontNode.GetText()", func () {
|
gNode.NewButton("fontNode.GetText()", func() {
|
||||||
if (fontNode != nil) {
|
if fontNode != nil {
|
||||||
fontsize = fontNode.GetText()
|
fontsize = fontNode.GetText()
|
||||||
log.Println("set fontsize =", fontsize)
|
log.Println("set fontsize =", fontsize)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue