From 86943f3731fdb8d5a55fb3af1537cda94babef43 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 2 Nov 2021 23:44:28 -0500 Subject: [PATCH] START: initial commit --- Makefile | 80 ++++++ README.md | 17 ++ go.mod | 44 +++ go.sum | 183 +++++++++++++ gui-button.go | 55 ++++ icon.go | 314 ++++++++++++++++++++++ main.go | 84 ++++++ os.go | 115 ++++++++ pprof.go | 81 ++++++ resources/VERSION | 1 + resources/apt/Makefile | 44 +++ resources/apt/sources.list | 23 ++ resources/apt/wit-org.list | 2 + resources/bin/apt-file.sh | 5 + resources/bin/games.sh | 30 +++ resources/bin/install-applications.sh | 89 ++++++ resources/bin/install-default-packages.sh | 7 + resources/bin/steam.sh | 6 + resources/resolv/resolv-1-1-1-1.conf | 4 + resources/resolv/resolv-4.2.2.2.conf | 4 + resources/resolv/resolv-8-8-8-8.conf | 4 + resources/resolv/resolv-ipv6-only.conf | 7 + resources/resolv/resolv-localhost.conf | 8 + systray.go | 148 ++++++++++ tioc_bsd.go | 12 + watch.go | 90 +++++++ window-debug-golang.go | 88 ++++++ window-debug.go | 100 +++++++ window-dns-update.go | 37 +++ window-main.go | 48 ++++ window-resets.go | 63 +++++ window-resolv.go | 57 ++++ window-ssh-generic.go | 80 ++++++ window-www.go | 50 ++++ window-xterm-fontsize.go | 52 ++++ 35 files changed, 2032 insertions(+) create mode 100644 Makefile create mode 100644 README.md create mode 100644 go.mod create mode 100644 go.sum create mode 100644 gui-button.go create mode 100644 icon.go create mode 100644 main.go create mode 100644 os.go create mode 100644 pprof.go create mode 100644 resources/VERSION create mode 100644 resources/apt/Makefile create mode 100644 resources/apt/sources.list create mode 100644 resources/apt/wit-org.list create mode 100755 resources/bin/apt-file.sh create mode 100755 resources/bin/games.sh create mode 100755 resources/bin/install-applications.sh create mode 100755 resources/bin/install-default-packages.sh create mode 100755 resources/bin/steam.sh create mode 100644 resources/resolv/resolv-1-1-1-1.conf create mode 100644 resources/resolv/resolv-4.2.2.2.conf create mode 100644 resources/resolv/resolv-8-8-8-8.conf create mode 100644 resources/resolv/resolv-ipv6-only.conf create mode 100644 resources/resolv/resolv-localhost.conf create mode 100644 systray.go create mode 100644 tioc_bsd.go create mode 100644 watch.go create mode 100644 window-debug-golang.go create mode 100644 window-debug.go create mode 100644 window-dns-update.go create mode 100644 window-main.go create mode 100644 window-resets.go create mode 100644 window-resolv.go create mode 100644 window-ssh-generic.go create mode 100644 window-www.go create mode 100644 window-xterm-fontsize.go diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..71e9db5 --- /dev/null +++ b/Makefile @@ -0,0 +1,80 @@ +GITCOMMIT = $(shell git rev-list -1 HEAD) +GOVERSION = $(shell go version | cut -d' ' -f 3) +BUILDTIME = $(shell date -u --iso-8601=seconds) +VERSION = $(shell cat resources/VERSION) + +# PATH=/usr/bin:$PATH go version + +run: build + ~/go/bin/wit-debian-gui + +build: + GO111MODULE="off" go install -ldflags " \ + -X main.GITCOMMIT=${GITCOMMIT} \ + -X main.GOVERSION='${GOVERSION}' \ + -X main.BUILDTIME='${BUILDTIME}' \ + -X main.VERSION=${VERSION}" + +godoc: + godoc -http=:6060 + +gomod-update: + wit go update + +gomod-init: + go mod init + go mod tidy + +gomod-clean: + rm -f go.* + +sudo: build + sudo ~/go/bin/wit-debian-gui + +# https://golang.cafe/blog/golang-debugging-with-delve.html +# debug using 'delve' +debug: + dlv debug + +push: + wit git push + +prep: + apt install -y libgtk-3-dev + apt install -y libappindicator3-dev + apt install -y xterm + +tag-version: + # git push --delete origin v0.6.15 # to delete a tag upstream + git diff --quiet + # go build # just an extra check to make sure the damn thing builds + git tag v${VERSION} + git push --tags + +icon: + go get -v github.com/cratonica/2goarray + go install github.com/cratonica/2goarray + echo "//+build linux darwin" > icon.go + echo >> icon.go + cat resources/wit.png | 2goarray Data icon >> icon.go + +# a custom go target name +generate: + go generate + +build-all: + GOOS=linux GOARCH=386 go build -o bin/linux.x32.bin + GOOS=freebsd GOARCH=386 go build -o bin/freebsd.x32.bin + GOOS=darwin GOARCH=386 go build -o bin/darwin.x32.bin + +# https://www.digitalocean.com/community/tutorials/how-to-build-go-executables-for-multiple-platforms-on-ubuntu-16-04 +build-darwin: + env GOOS=darwin GOARCH=amd64 go build + +build-windows: + env GOOS=windows GOARCH=amd64 go build + +gaper: + # 'gaper' is a simple and smart golang tool that just rebuilds every time you change a file + # go get -u github.com/maxcnunes/gaper + gaper diff --git a/README.md b/README.md new file mode 100644 index 0000000..756906e --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# my app for debugging things + +## build requirements +``` +apt install -f libgtk-3-dev +``` + +## checkout & build + +``` +go get -v -t -u git.wit.org/wit/wit-debian-gui +cd ~/go/src/git.wit.org/wit/wit-debian-gui +go build +``` + +# Copyright +GPLv2+ diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..231f8c5 --- /dev/null +++ b/go.mod @@ -0,0 +1,44 @@ +module git.wit.org/jcarr/personal-gui + +go 1.17 + +require ( + git.wit.org/jcarr/log v0.0.5 + git.wit.org/wit/gui v0.0.6-0.20211031175754-d38d60bcc38b + git.wit.org/wit/shell v0.0.0-20210809053806-ad28138b847a + github.com/andlabs/ui v0.0.0-20200610043537-70a69d6ae31e + github.com/davecgh/go-spew v1.1.1 + github.com/getlantern/systray v1.1.0 + github.com/gobuffalo/packr v1.30.1 + github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 +) + +require ( + github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect + github.com/gdamore/encoding v1.0.0 // indirect + github.com/gdamore/tcell/v2 v2.0.0 // indirect + github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 // indirect + github.com/getlantern/errors v1.0.1 // indirect + github.com/getlantern/golog v0.0.0-20210606115803-bce9f9fe5a5f // indirect + github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7 // indirect + github.com/getlantern/hidden v0.0.0-20201229170000-e66e7f878730 // indirect + github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6 // indirect + github.com/go-stack/stack v1.8.1 // indirect + github.com/gobuffalo/envy v1.9.0 // indirect + github.com/gobuffalo/packd v1.0.0 // indirect + github.com/joho/godotenv v1.4.0 // indirect + github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect + github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect + github.com/lucasb-eyer/go-colorful v1.0.3 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect + github.com/rogpeppe/go-internal v1.8.0 // indirect + github.com/sirupsen/logrus v1.8.1 // indirect + github.com/svent/go-nbreader v0.0.0-20150201200112-7cef48da76dc // indirect + github.com/tmc/scp v0.0.0-20170824174625-f7b48647feef // indirect + github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3 // indirect + golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect + golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect + golang.org/x/sys v0.0.0-20211031064116-611d5d643895 // indirect + golang.org/x/text v0.3.6 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..ef74d59 --- /dev/null +++ b/go.sum @@ -0,0 +1,183 @@ +git.wit.org/jcarr/log v0.0.0-20211026052444-76ae5ca4afb4 h1:zsTcYeIr84cUcZf42bE/IXmn9kCJNK5mtJMPAi6DOdQ= +git.wit.org/jcarr/log v0.0.0-20211026052444-76ae5ca4afb4/go.mod h1:rD4mfBZHXgbcFT9Hh4+gGBbWZ/kId2qVnwYUzLhJO6Q= +git.wit.org/jcarr/log v0.0.5 h1:PeMbp5s+FMwjPfXc2qUyDuGHostXz9kOjUP3vBSDzpU= +git.wit.org/jcarr/log v0.0.5/go.mod h1:rD4mfBZHXgbcFT9Hh4+gGBbWZ/kId2qVnwYUzLhJO6Q= +git.wit.org/wit/gui v0.0.0-20211006070239-403dc4780b2c h1:jEyEm+rthz2bzovXuNARzrJM+Aipc8XH1wy5rmxvPLg= +git.wit.org/wit/gui v0.0.0-20211006070239-403dc4780b2c/go.mod h1:Bb3kJYz29thAO6TEoA5H5a213p1+1XzS3K13f7LaZOc= +git.wit.org/wit/gui v0.0.0-20211006193207-36e2c6d2e3c2 h1:u/VLZ6H1Oa/omdNzNOSfFMtYfy+69zmZ0o39d743sVQ= +git.wit.org/wit/gui v0.0.0-20211006193207-36e2c6d2e3c2/go.mod h1:7t/uh0UIQ+0aDyROWOROm4oJt8Fvatqf3fXPKRrV/IQ= +git.wit.org/wit/gui v0.0.4 h1:A3C66vqYPE9dX/thaAji1GRx13QCvBmK/A+ghSK8wwE= +git.wit.org/wit/gui v0.0.4/go.mod h1:7t/uh0UIQ+0aDyROWOROm4oJt8Fvatqf3fXPKRrV/IQ= +git.wit.org/wit/gui v0.0.5 h1:KAJNq+KQyhJ/BuCJEQfgl6QT1U6HA535zg97b+RCc7Q= +git.wit.org/wit/gui v0.0.5/go.mod h1:7t/uh0UIQ+0aDyROWOROm4oJt8Fvatqf3fXPKRrV/IQ= +git.wit.org/wit/gui v0.0.6-0.20211031175754-d38d60bcc38b h1:MrCN9q3pyxs8I4GKx2yjMKvysDekHJI+xFCwln1tvKg= +git.wit.org/wit/gui v0.0.6-0.20211031175754-d38d60bcc38b/go.mod h1:7t/uh0UIQ+0aDyROWOROm4oJt8Fvatqf3fXPKRrV/IQ= +git.wit.org/wit/shell v0.0.0-20210809053806-ad28138b847a h1:6m+E3971o+vg1O9im2QSXbefzF5NcZdLh2jP48cAdbM= +git.wit.org/wit/shell v0.0.0-20210809053806-ad28138b847a/go.mod h1:StNrN70kYxjG2IzyBv4fSPB4Pd7yg/YNBNLYtftP+NM= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/andlabs/ui v0.0.0-20200610043537-70a69d6ae31e h1:wSQCJiig/QkoUnpvelSPbLiZNWvh2yMqQTQvIQqSUkU= +github.com/andlabs/ui v0.0.0-20200610043537-70a69d6ae31e/go.mod h1:5G2EjwzgZUPnnReoKvPWVneT8APYbyKkihDVAHUi0II= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/awesome-gocui/gocui v1.0.1 h1:FGzyh+K9NRZTVrj5QhoKVc5iSq1MojzwFFsU7rEmeIs= +github.com/awesome-gocui/gocui v1.0.1/go.mod h1:UvP3dP6+UsTGl9IuqP36wzz6Lemo90wn5p3tJvZ2OqY= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf h1:iW4rZ826su+pqaw19uhpSCzhj44qo35pNgKFGqzDKkU= +github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= +github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= +github.com/gdamore/tcell/v2 v2.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs= +github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= +github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4= +github.com/getlantern/context v0.0.0-20190109183933-c447772a6520/go.mod h1:L+mq6/vvYHKjCX2oez0CgEAJmbq1fbb/oNJIWQkBybY= +github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7 h1:6uJ+sZ/e03gkbqZ0kUG6mfKoqDb4XMAzMIwlajq19So= +github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7/go.mod h1:l+xpFBrCtDLpK9qNjxs+cHU6+BAdlBaxHqikB6Lku3A= +github.com/getlantern/errors v1.0.1 h1:XukU2whlh7OdpxnkXhNH9VTLVz0EVPGKDV5K0oWhvzw= +github.com/getlantern/errors v1.0.1/go.mod h1:l+xpFBrCtDLpK9qNjxs+cHU6+BAdlBaxHqikB6Lku3A= +github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7 h1:guBYzEaLz0Vfc/jv0czrr2z7qyzTOGC9hiQ0VC+hKjk= +github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7/go.mod h1:zx/1xUUeYPy3Pcmet8OSXLbF47l+3y6hIPpyLWoR9oc= +github.com/getlantern/golog v0.0.0-20210606115803-bce9f9fe5a5f h1:wsVt3P/boVKkPFEZkWxgNgRq/+mD7sWHc17+Vw2PgH8= +github.com/getlantern/golog v0.0.0-20210606115803-bce9f9fe5a5f/go.mod h1:ZyIjgH/1wTCl+B+7yH1DqrWp6MPJqESmwmEQ89ZfhvA= +github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7 h1:micT5vkcr9tOVk1FiH8SWKID8ultN44Z+yzd2y/Vyb0= +github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7/go.mod h1:dD3CgOrwlzca8ed61CsZouQS5h5jIzkK9ZWrTcf0s+o= +github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 h1:XYzSdCbkzOC0FDNrgJqGRo8PCMFOBFL9py72DRs7bmc= +github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55/go.mod h1:6mmzY2kW1TOOrVy+r41Za2MxXM+hhqTtY3oBKd2AgFA= +github.com/getlantern/hidden v0.0.0-20201229170000-e66e7f878730 h1:oKJVQbWZ2CAJ71jYnm6A3+e6h5bkPJ0okIMwkaYB5HI= +github.com/getlantern/hidden v0.0.0-20201229170000-e66e7f878730/go.mod h1:6mmzY2kW1TOOrVy+r41Za2MxXM+hhqTtY3oBKd2AgFA= +github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f h1:wrYrQttPS8FHIRSlsrcuKazukx/xqO/PpLZzZXsF+EA= +github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA= +github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6 h1:QthAQCekS1YOeYWSvoHI6ZatlG4B+GBDLxV/2ZkBsTA= +github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA= +github.com/getlantern/systray v1.1.0 h1:U0wCEqseLi2ok1fE6b88gJklzriavPJixZysZPkZd/Y= +github.com/getlantern/systray v1.1.0/go.mod h1:AecygODWIsBquJCJFop8MEQcJbWFfw/1yWbVabNgpCM= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= +github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/gobuffalo/envy v1.7.0 h1:GlXgaiBkmrYMHco6t4j7SacKO4XUjvh5pwXh0f4uxXU= +github.com/gobuffalo/envy v1.7.0/go.mod h1:n7DRkBerg/aorDM8kbduw5dN3oXGswK5liaSCx4T5NI= +github.com/gobuffalo/envy v1.9.0 h1:eZR0DuEgVLfeIb1zIKt3bT4YovIMf9O9LXQeCZLXpqE= +github.com/gobuffalo/envy v1.9.0/go.mod h1:FurDp9+EDPE4aIUS3ZLyD+7/9fpx7YRt/ukY6jIHf0w= +github.com/gobuffalo/logger v1.0.0/go.mod h1:2zbswyIUa45I+c+FLXuWl9zSWEiVuthsk8ze5s8JvPs= +github.com/gobuffalo/packd v0.3.0 h1:eMwymTkA1uXsqxS0Tpoop3Lc0u3kTfiMBE6nKtQU4g4= +github.com/gobuffalo/packd v0.3.0/go.mod h1:zC7QkmNkYVGKPw4tHpBQ+ml7W/3tIebgeo1b36chA3Q= +github.com/gobuffalo/packd v1.0.0 h1:6ERZvJHfe24rfFmA9OaoKBdC7+c9sydrytMg8SdFGBM= +github.com/gobuffalo/packd v1.0.0/go.mod h1:6VTc4htmJRFB7u1m/4LeMTWjFoYrUiBkU9Fdec9hrhI= +github.com/gobuffalo/packr v1.30.1 h1:hu1fuVR3fXEZR7rXNW3h8rqSML8EVAf6KNm0NKO/wKg= +github.com/gobuffalo/packr v1.30.1/go.mod h1:ljMyFO2EcrnzsHsN99cvbq055Y9OhRrIaviy289eRuk= +github.com/gobuffalo/packr/v2 v2.5.1/go.mod h1:8f9c96ITobJlPzI44jj+4tHnEKNt0xXWSVlXRN9X1Iw= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= +github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= +github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg= +github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= +github.com/karrick/godirwalk v1.10.12/go.mod h1:RoGL9dQei4vP9ilrpETWE8CLOZ1kiN0LhBygSwrAsHA= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= +github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= +github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= +github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw= +github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.0 h1:RR9dF3JtopPvtkroDZuVD7qquD0bnHlKSqaQhgwt8yk= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.3.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA= +github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/svent/go-nbreader v0.0.0-20150201200112-7cef48da76dc h1:usYkrH2/es/TT7ETdC/qLAagcJPW3EEYFKqvibSnFbA= +github.com/svent/go-nbreader v0.0.0-20150201200112-7cef48da76dc/go.mod h1:pPzZl0vMkUhyoxUF8PAGG5bDRGo7PY80oO/PMmpLkkc= +github.com/tmc/scp v0.0.0-20170824174625-f7b48647feef h1:7D6Nm4D6f0ci9yttWaKjM1TMAXrH5Su72dojqYGntFY= +github.com/tmc/scp v0.0.0-20170824174625-f7b48647feef/go.mod h1:WLFStEdnJXpjK8kd4qKLwQKX/1vrDzp5BcDyiZJBHJM= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3 h1:shC1HB1UogxN5Ech3Yqaaxj1X/P656PPCB4RbojIJqc= +github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3/go.mod h1:XCsSkdKK4gwBMNrOCZWww0pX6AOt+2gYc5Z6jBRrNVg= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4 h1:ydJNl0ENAG67pFbB+9tfhiL2pYqLhfoaZFw/cjLhY4A= +golang.org/x/crypto v0.0.0-20190621222207-cc06ce4a13d4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d h1:RNPAfi2nHY7C2srAV8A49jpsYr0ADedCk1wq6fTMTvs= +golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ= +golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190515120540-06a5c4944438/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211006225509-1a26e0398eed h1:E159xujlywdAeN3FqsTBPzRKGUq/pDHolXbuttkC36E= +golang.org/x/sys v0.0.0-20211006225509-1a26e0398eed/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211023085530-d6a326fbbf70 h1:SeSEfdIxyvwGJliREIJhRPPXvW6sDlLT+UQ3B0hD0NA= +golang.org/x/sys v0.0.0-20211023085530-d6a326fbbf70/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211031064116-611d5d643895 h1:iaNpwpnrgL5jzWS0vCNnfa8HqzxveCFpFx3uC/X4Tps= +golang.org/x/sys v0.0.0-20211031064116-611d5d643895/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190624180213-70d37148ca0c/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/gui-button.go b/gui-button.go new file mode 100644 index 0000000..657b04b --- /dev/null +++ b/gui-button.go @@ -0,0 +1,55 @@ +package main + +import "log" +// import "os" + +import "git.wit.org/wit/gui" +// import "github.com/skratchdot/open-golang/open" +// import "github.com/davecgh/go-spew/spew" + +// +// This was the default handler for all mouse clicks (buttons, areas, etc)) +// +// Most mouse clicks are now moved to custom functions +// + +type myButtonInfo struct { + Custom func (*gui.Node) + ADD func (*gui.Node) + Name string + Action string + Node *gui.Node +} + +// 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 { + val := &myButtonInfo{} + val.Custom = custom + val.Name = name + // val.Action = action + return val +} + +// stores the fields we want to map into our private structure 'values' +func newMmakeButtonValues(name string, custom func(*gui.Node)) *myButtonInfo { + val := &myButtonInfo{} + val.Custom = custom + val.Name = name + // val.Action = action + return val +} + +func makeXtermButton(n *gui.Node, name string, action string, custom string) *gui.Node { + n.AddButton(name, func (*gui.Node) { + log.Println("xterm cmd=", custom) + xterm(custom) + }) + return nil +} + +func makeColorButton(n *gui.Node, name string, action string, custom func(*gui.Node)) *gui.Node { + val := makeButtonValues(n, name, action, custom) + log.Println("val =", val) + // return gui.CreateColorButton(n, custom, name, val) + return nil +} diff --git a/icon.go b/icon.go new file mode 100644 index 0000000..0dea2f3 --- /dev/null +++ b/icon.go @@ -0,0 +1,314 @@ +//+build linux darwin + +// File generated by 2goarray v0.1.0 (http://github.com/cratonica/2goarray) + +package main + +var myIcon []byte = []byte{ + 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, + 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, + 0x08, 0x06, 0x00, 0x00, 0x00, 0xc3, 0x3e, 0x61, 0xcb, 0x00, 0x00, 0x01, + 0x85, 0x69, 0x43, 0x43, 0x50, 0x49, 0x43, 0x43, 0x20, 0x70, 0x72, 0x6f, + 0x66, 0x69, 0x6c, 0x65, 0x00, 0x00, 0x28, 0x91, 0x7d, 0x91, 0x3d, 0x48, + 0xc3, 0x40, 0x1c, 0xc5, 0x5f, 0x53, 0x6b, 0x45, 0xaa, 0x22, 0x76, 0x10, + 0x71, 0xc8, 0x50, 0x05, 0xc1, 0x82, 0xa8, 0x88, 0xa3, 0x56, 0xa1, 0x08, + 0x15, 0x42, 0xad, 0xd0, 0xaa, 0x83, 0xc9, 0xa5, 0x1f, 0x42, 0x93, 0x86, + 0x24, 0xc5, 0xc5, 0x51, 0x70, 0x2d, 0x38, 0xf8, 0xb1, 0x58, 0x75, 0x70, + 0x71, 0xd6, 0xd5, 0xc1, 0x55, 0x10, 0x04, 0x3f, 0x40, 0xdc, 0xdc, 0x9c, + 0x14, 0x5d, 0xa4, 0xc4, 0xff, 0x25, 0x85, 0x16, 0xb1, 0x1e, 0x1c, 0xf7, + 0xe3, 0xdd, 0xbd, 0xc7, 0xdd, 0x3b, 0x40, 0xa8, 0x16, 0x99, 0x66, 0xb5, + 0x8d, 0x01, 0x9a, 0x6e, 0x9b, 0xc9, 0x78, 0x4c, 0x4c, 0x67, 0x56, 0xc4, + 0xe0, 0x2b, 0xda, 0xd1, 0x8b, 0x00, 0xba, 0x31, 0x22, 0x33, 0xcb, 0x98, + 0x95, 0xa4, 0x04, 0x5a, 0x8e, 0xaf, 0x7b, 0xf8, 0xf8, 0x7a, 0x17, 0xe5, + 0x59, 0xad, 0xcf, 0xfd, 0x39, 0xba, 0xd4, 0xac, 0xc5, 0x00, 0x9f, 0x48, + 0x3c, 0xc3, 0x0c, 0xd3, 0x26, 0x5e, 0x27, 0x9e, 0xda, 0xb4, 0x0d, 0xce, + 0xfb, 0xc4, 0x61, 0x56, 0x90, 0x55, 0xe2, 0x73, 0xe2, 0x51, 0x93, 0x2e, + 0x48, 0xfc, 0xc8, 0x75, 0xc5, 0xe3, 0x37, 0xce, 0x79, 0x97, 0x05, 0x9e, + 0x19, 0x36, 0x53, 0xc9, 0x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 0xad, 0xc5, 0xbb, 0x3b, 0x9a, 0x7b, + 0xfb, 0xf7, 0x4c, 0xbd, 0xbf, 0x1f, 0x3b, 0xf3, 0x72, 0x91, 0x54, 0x3a, + 0x3d, 0x2b, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47, 0x44, 0x00, 0xff, + 0x00, 0xff, 0x00, 0xff, 0xa0, 0xbd, 0xa7, 0x93, 0x00, 0x00, 0x00, 0x09, + 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00, 0x0b, 0x13, + 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74, 0x49, 0x4d, + 0x45, 0x07, 0xe5, 0x06, 0x11, 0x05, 0x0f, 0x01, 0x1b, 0xec, 0x0b, 0x79, + 0x00, 0x00, 0x0c, 0x42, 0x49, 0x44, 0x41, 0x54, 0x78, 0xda, 0xed, 0x9d, + 0x7d, 0x70, 0xdc, 0x55, 0xb9, 0xc7, 0x3f, 0xcf, 0xef, 0xb7, 0x79, 0x4f, + 0x0b, 0xd8, 0xa6, 0xb4, 0x58, 0x2e, 0x85, 0xd6, 0xee, 0x86, 0x84, 0x97, + 0x6b, 0xbd, 0x5c, 0x04, 0x07, 0x1c, 0x65, 0xb8, 0x80, 0x52, 0xa7, 0xa3, + 0x49, 0x93, 0x2a, 0xb4, 0x30, 0x95, 0xd2, 0x04, 0xb8, 0x14, 0xaf, 0xdc, + 0xeb, 0x0b, 0x4e, 0x74, 0xee, 0x0c, 0xcc, 0xa8, 0xbd, 0x5c, 0x9a, 0x4d, + 0x5b, 0xb4, 0xb6, 0x5c, 0x68, 0x93, 0x66, 0x11, 0x51, 0x79, 0x67, 0x80, + 0x82, 0x02, 0x82, 0x82, 0xbd, 0xd8, 0x34, 0x1b, 0xfa, 0x42, 0xad, 0x54, + 0x69, 0x52, 0xaa, 0xb4, 0x79, 0xdf, 0xdd, 0xf3, 0xf8, 0x47, 0x52, 0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0x9a, 0x53, 0xe6, 0xfb, 0xa1, 0x6f, 0x02, 0xd7, 0x02, 0xa5, 0x13, 0x68, + 0xca, 0x9f, 0x41, 0x7e, 0xa2, 0xe8, 0xe6, 0xfd, 0x5d, 0xd3, 0x9f, 0xde, + 0xd2, 0xb0, 0x25, 0xe9, 0x04, 0x30, 0x86, 0x5c, 0xf5, 0xdd, 0xb3, 0x4b, + 0x12, 0x45, 0x03, 0x2b, 0x44, 0xe4, 0x56, 0x85, 0x49, 0x81, 0x6a, 0x6c, + 0x91, 0x05, 0xcd, 0x75, 0xed, 0x0f, 0x06, 0xc9, 0xa6, 0x50, 0x36, 0x39, + 0xbf, 0xba, 0xa9, 0xfc, 0x92, 0x84, 0x0e, 0x6e, 0x00, 0xf9, 0xb0, 0xba, + 0x01, 0x7e, 0xee, 0x08, 0xa0, 0xaa, 0xb5, 0x22, 0x3f, 0xd4, 0x99, 0xba, + 0x5d, 0x55, 0x57, 0xe4, 0xf2, 0xcc, 0x26, 0x27, 0x05, 0x50, 0x13, 0xad, + 0x3c, 0x55, 0xbb, 0x12, 0x3f, 0x53, 0x91, 0x73, 0x9d, 0x3b, 0x73, 0x4c, + 0x00, 0xb5, 0x8d, 0x67, 0x56, 0x28, 0xc9, 0xc7, 0x04, 0x99, 0xe9, 0x5c, + 0x99, 0x1e, 0x5e, 0xc6, 0xf6, 0xf7, 0xab, 0xc2, 0x17, 0xaa, 0x98, 0x5f, + 0x00, 0xce, 0xf9, 0xb9, 0x16, 0x01, 0x16, 0x36, 0x95, 0x9f, 0x2f, 0xaa, + 0x4f, 0x02, 0x45, 0xa3, 0x50, 0x5d, 0x37, 0xf0, 0x02, 0xf0, 0xa2, 0x88, + 0xee, 0xc4, 0xc8, 0xae, 0x64, 0x9e, 0xbf, 0xaf, 0x28, 0x91, 0xea, 0xe9, + 0x32, 0xc9, 0xee, 0xbe, 0x83, 0x33, 0x53, 0x65, 0x33, 0xf6, 0x96, 0x60, + 0x42, 0xa5, 0x9e, 0xf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0x73, 0x9e, 0x4f, 0xa1, + 0xdd, 0x76, 0x63, 0x67, 0x55, 0x2b, 0xbe, 0xdf, 0x15, 0xf9, 0x57, 0x11, + 0xe6, 0xa9, 0xa1, 0x12, 0xa1, 0x72, 0x38, 0xea, 0x9c, 0xc0, 0x50, 0x62, + 0x08, 0x0f, 0xe8, 0x05, 0x7a, 0x05, 0x0e, 0x29, 0xec, 0x05, 0xf6, 0x88, + 0xf0, 0x86, 0x51, 0x5e, 0x31, 0xa1, 0xc1, 0x97, 0x62, 0xcb, 0x76, 0xbf, + 0xe3, 0x04, 0x30, 0x16, 0x11, 0x40, 0xa8, 0xc4, 0x42, 0x01, 0x22, 0xba, + 0xf5, 0x78, 0x3e, 0xd7, 0xd0, 0x80, 0xd7, 0x3e, 0x35, 0x72, 0x85, 0x27, + 0x54, 0x69, 0x17, 0x9f, 0x01, 0xa6, 0xa8, 0x72, 0xac, 0xef, 0x41, 0x4f, + 0x00, 0x4e, 0x50, 0x98, 0x01, 0x84, 0x01, 0x54, 0x87, 0x3e, 0xee, 0x27, + 0xf3, 0xb5, 0x26, 0x1a, 0x69, 0x13, 0x78, 0x48, 0x84, 0xfb, 0x37, 0xd5, + 0xc5, 0x5f, 0xc9, 0x74, 0x01, 0x04, 0xe2, 0xeb, 0xe0, 0xe1, 0x37, 0xb3, + 0x07, 0x8b, 0xef, 0xfe, 0x55, 0xf8, 0xca, 0xe6, 0xba, 0xf8, 0xca, 0xf7, + 0xad, 0x73, 0xe5, 0xcc, 0x22, 0x2f, 0xbf, 0x64, 0x89, 0x88, 0xac, 0x00, + 0x3e, 0x32, 0x36, 0xad, 0x27, 0xbb, 0x54, 0xcd, 0x2a, 0x43, 0x68, 0xdd, + 0x78, 0xec, 0x36, 0xce, 0xde, 0x31, 0xc0, 0x81, 0xf0, 0x1c, 0x2c, 0x37, + 0x7e, 0x78, 0xaa, 0xdb, 0xdf, 0xef, 0x6f, 0x35, 0x8d, 0xe5, 0x0b, 0xfc, + 0x82, 0x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0x65, 0x81, 0xb7, 0x01, 0x6a, 0x1b, 0xc3, 0xd5, 0x82, + 0xae, 0x27, 0xb8, 0x7b, 0x1b, 0x67, 0xfa, 0x2a, 0xcf, 0x2d, 0x5c, 0x5d, + 0x5e, 0xe9, 0x04, 0x70, 0xec, 0x45, 0x1d, 0xbb, 0x08, 0x20, 0xe6, 0xc0, + 0xc2, 0xbb, 0xe6, 0x9e, 0xa3, 0x22, 0x1b, 0x08, 0x7e, 0x92, 0x8b, 0x69, + 0x92, 0xd2, 0x87, 0x6b, 0xef, 0xac, 0x3c, 0xd9, 0x09, 0xe0, 0x98, 0xa3, + 0x68, 0x1b, 0xc5, 0x78, 0x09, 0xf1, 0xbd, 0xfb, 0x49, 0x23, 0x47, 0x80, + 0xa2, 0x5b, 0x45, 0x59, 0xa9, 0xa2, 0xd5, 0x78, 0xde, 0x47, 0x25, 0x64, + 0xca, 0x52, 0x03, 0xdd, 0xc5, 0xa9, 0xb2, 0x78, 0x28, 0x15, 0x1a, 0x3c, + 0x11, 0x8f, 0xd3, 0x51, 0xef, 0x12, 0x54, 0xff, 0x1d, 0xf8, 0x09, 0x43, + 0x79, 0x01, 0x46, 0x1a, 0xe2, 0xfe, 0x49, 0x43, 0xa9, 0x9f, 0x55, 0xad, + 0x9c, 0x59, 0x14, 0x34, 0x01, 0x04, 0x65, 0x25, 0xd0, 0xae, 0x61, 0x54, + 0xbf, 0x84, 0x90, 0x6f, 0x51, 0xa2, 0x57, 0x94, 0x35, 0x49, 0x4f, 0xef, + 0x3e, 0xf6, 0xee, 0xa1, 0xdd, 0x47, 0x12, 0x41, 0xec, 0x01, 0x9e, 0x02, + 0xee, 0x5a, 0xb2, 0x7e, 0x56, 0x61, 0x7f, 0x6f, 0xd1, 0xe7, 0x40, 0xff, + 0x03, 0xf8, 0xd8, 0x08, 0x46, 0xba, 0xe7, 0x85, 0x0a, 0x26, 0xdd, 0x0e, + 0xdc, 0x1c, 0x24, 0x01, 0x04, 0x62, 0x25, 0xb0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0xfa, 0x6b, 0x27, 0x80, 0xbf, 0x6f, 0x92, 0x66, 0xcb, + 0x02, 0x1f, 0xae, 0x59, 0x7d, 0xe6, 0x3f, 0x07, 0x64, 0x00, 0x78, 0xa5, + 0x75, 0x19, 0x4f, 0x5e, 0x76, 0x02, 0x38, 0x7a, 0x3a, 0x98, 0xef, 0x35, + 0xdb, 0x6e, 0xae, 0x54, 0x63, 0xbe, 0x38, 0xd1, 0x76, 0x5f, 0xdd, 0x18, + 0x99, 0x22, 0xf6, 0x07, 0x46, 0x13, 0x85, 0x03, 0x05, 0xcf, 0x3b, 0x01, + 0x1c, 0x3d, 0x1d, 0x5c, 0xda, 0x76, 0x10, 0xc1, 0x6a, 0x6f, 0x9d, 0xc0, + 0xe2, 0x2b, 0xd7, 0xce, 0x9b, 0xd0, 0x45, 0xa1, 0x41, 0x4f, 0x96, 0x62, + 0x99, 0xa7, 0x48, 0xe0, 0xd9, 0x89, 0xbe, 0xeb, 0x28, 0x90, 0xe9, 0x55, + 0x04, 0x36, 0x58, 0x16, 0x99, 0x5a, 0x92, 0xe8, 0x5e, 0x3a, 0x51, 0xf6, + 0x2e, 0x59, 0x3f, 0xab, 0x10, 0x55, 0xeb, 0xc4, 0x0f, 0x2a, 0xf2, 0xe0, + 0x44, 0xb7, 0x75, 0x20, 0x05, 0xd0, 0x5c, 0x17, 0x7f, 0x08, 0xa4, 0xdd, + 0x72, 0x02, 0xfe, 0xcd, 0x45, 0x4d, 0x67, 0x9d, 0x34, 0x11, 0xf6, 0xf6, + 0xf5, 0x15, 0xde, 0x8a, 0x6d, 0xd2, 0x08, 0x65, 0x30, 0x4f, 0x06, 0x63, + 0x4e, 0x00, 0xef, 0x1d, 0x02, 0x54, 0xc1, 0xf6, 0x1e, 0xc0, 0x32, 0x63, + 0x12, 0xe3, 0x7e, 0x77, 0x60, 0x55, 0xb4, 0x62, 0x8e, 0x28, 0xff, 0x65, + 0xdf, 0xf2, 0xba, 0xf9, 0xde, 0xe5, 0xbb,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0x9d, + 0x00, 0x8e, 0x70, 0xe5, 0xda, 0x79, 0xc5, 0xc5, 0x89, 0xde, 0xf9, 0x9e, + 0xe8, 0xe5, 0x0a, 0x97, 0x92, 0xfe, 0x2d, 0x1f, 0x47, 0xb3, 0x0f, 0x78, + 0x52, 0x95, 0x1f, 0x9b, 0x69, 0xfe, 0x13, 0xb1, 0xea, 0xb6, 0xc1, 0x4c, + 0x6f, 0xa7, 0xac, 0x15, 0xc0, 0x3f, 0xf4, 0xcf, 0x52, 0xbb, 0x3a, 0x7c, + 0x96, 0x1a, 0xef, 0x1c, 0xd0, 0x72, 0x84, 0x08, 0xc2, 0x19, 0x28, 0x93, + 0x81, 0x52, 0x60, 0x12, 0x90, 0x0f, 0xf4, 0x31, 0x94, 0x74, 0xa2, 0x1b, + 0x64, 0x1f, 0xb0, 0x07, 0xcc, 0x1b, 0xa2, 0x6c, 0x53, 0xc9, 0x7b, 0xb1, + 0xa5, 0x7e, 0xdb, 0x1f, 0x70, 0x38, 0x1c, 0x0e, 0x87, 0xc3, 0xe1, 0x70, + 0x38, 0x1c, 0x0e, 0x87, 0xc3, 0xe1, 0x70, 0x38, 0x1c, 0x0e, 0x87, 0xc3, + 0xe1, 0x70, 0x38, 0x1c, 0x0e, 0x87, 0x23, 0xf8, 0xfc, 0x15, 0x5f, 0x1c, + 0x32, 0xb4, 0xe4, 0xcf, 0xc8, 0x05, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, + 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, +} + diff --git a/main.go b/main.go new file mode 100644 index 0000000..854ceab --- /dev/null +++ b/main.go @@ -0,0 +1,84 @@ +package main + +import origlog "log" + +import ( + "git.wit.org/jcarr/log" + "os" + "time" + + "git.wit.org/wit/gui" +// "github.com/davecgh/go-spew/spew" + "github.com/gobuffalo/packr" +) + +var GITCOMMIT string // this is passed in as an ldflag +var GOVERSION string // this is passed in as an ldflag +var VERSION string // this is passed in as an ldflag +var BUILDTIME string // this is passed in as an ldflag + +var closed bool = false +var loopsleep time.Duration = 100 // in tenths of seconds +var username string +var hostname string +var geom string = "120x30+500+500" + +var debugTest bool = false + +// var xterm = []string{"nohup", "xterm", "-geometry", geom} +var useFirefox bool = true +var firefox = []string{"firefox", "--new-window"} +var packrBox packr.Box + +func customExit(n *gui.Node) { + origlog.Println("Should Exit Here") + closed = true + /* + window := gui.Data.WindowMap["Debugging2"] + spew.Dump(window) + */ + time.Sleep(3 * time.Second) + log.Println("") + log.Println("CLEAN EXIT") + log.Println("") + os.Exit(0) +} + +func main() { + log.Println("starting my Control Panel") + log.Println("GOVERSION =", GOVERSION) + log.Println("GITCOMMIT =", GITCOMMIT) + + log.Println("packr ./resources box") + + // This puts all the files in that directory in the binary + // This directory includes the default config file if there is not already one + packrBox = packr.NewBox("./resources") + + filename := "ddns-tmp.conf" + b, _ := packrBox.FindString(filename) + log.Println(filename, "=\n\n", b) + + // go sshClient() + go pprofMain() + + // go gui.Main(dumbLoop) + go gui.Main(initGUI) + time.Sleep(2 * time.Second) + gui.Queue(delayedTabs) + go systrayMain() + watchWindows() +} + +// only os.Exit() on close of the main Window +// TODO: Change to only exit from systray(?) +func initGUI() { + gui.Config.Exit = customExit + mainWindow(nil) + gui.Config.Exit = nil +} + +func delayedTabs() { + log.Println("delayedTabs() could have added a tab here\n") + // jcarrWindow.AddTab("delayed tab", nil) +} diff --git a/os.go b/os.go new file mode 100644 index 0000000..7ff55a5 --- /dev/null +++ b/os.go @@ -0,0 +1,115 @@ +package main + +import "log" +import "strings" +import "os" +import "os/exec" +import "io/ioutil" +import "errors" +import "bufio" + +import "github.com/davecgh/go-spew/spew" + +/* +import "time" +import "runtime" +import "runtime/debug" +import "runtime/pprof" + +import "git.wit.org/wit/gui" +import "git.wit.org/wit/shell" +import "github.com/gobuffalo/packr" +*/ + +func runSimpleCommand(s string) { + cmd := strings.TrimSpace(s) // this is like 'chomp' in perl + cmd = strings.TrimSuffix(cmd, "\n") // this is like 'chomp' in perl + cmdArgs := strings.Fields(cmd) + runLinuxCommand(cmdArgs) +} + +func xterm(cmd string) { + var tmp []string + var argsXterm = []string{"nohup", "xterm", "-geometry", geom} + tmp = append(argsXterm, "-hold", "-e", cmd) + log.Println("xterm cmd=", cmd) + go runCommand(tmp) +} + +func runCommand(cmdArgs []string) { + log.Println("runCommand() START", cmdArgs) + process := exec.Command(cmdArgs[0], cmdArgs[1:len(cmdArgs)]...) + // process := exec.Command("xterm", "-e", "ping localhost") + log.Println("runCommand() process.Start()") + process.Start() + log.Println("runCommand() process.Wait()") + err := process.Wait() + lookupError(err) + log.Println("runCommand() NEED TO CHECK THE TIME HERE TO SEE IF THIS WORKED") + log.Println("runCommand() OTHERWISE INFORM THE USER") + log.Println("runCommand() END", cmdArgs) +} + +func lookupError(err error) { + var ( + ee *exec.ExitError + pe *os.PathError + ) + + if errors.As(err, &ee) { + log.Println("ran, but non-zero exit code =", ee.ExitCode()) // ran, but non-zero exit code + } else if errors.As(err, &pe) { + log.Printf("os.PathError = %v", pe) // "no such file ...", "permission denied" etc. + } else if err != nil { + log.Printf("something really bad happened general err = %v", err) // something really bad happened! + if exitError, ok := err.(*exec.ExitError); ok { + log.Printf("exitError.ExitCode() is %d\n", exitError.ExitCode()) + } + } else { + log.Println("success! // ran without error (exit code zero)") + } +} + +func runLinuxCommand(cmdArgs []string) (string, error) { + process := exec.Command(cmdArgs[0], cmdArgs[1:len(cmdArgs)]...) + + process.Stdin = os.Stdin + process.Stderr = os.Stderr + + stdOut, err := process.StdoutPipe() + if err != nil { + return "", err + } + + if err := process.Start(); err != nil { + return "", err + } + + bytes, err := ioutil.ReadAll(stdOut) + if err != nil { + return "", err + } + err = process.Wait() + lookupError(err) + + log.Println(string(bytes)) + return string(bytes), err +} + +func packrSaveFile(packrname string, filename string) error { + log.Println("packrSaveFile() for", packrname) + b, _ := packrBox.FindString(packrname) + log.Println(packrname, "=\n\n", b) + spew.Dump(b) + + f, err := os.Create(filename) + if err != nil { + return err + } + defer f.Close() + w := bufio.NewWriter(f) + n4, err := w.WriteString(b) + log.Println("n4 =", n4) + w.Flush() + return nil +} diff --git a/pprof.go b/pprof.go new file mode 100644 index 0000000..06c806a --- /dev/null +++ b/pprof.go @@ -0,0 +1,81 @@ +package main + +// run this and then hit: +// http://localhost:6060/debug/pprof/ +// +// Also run from the command line: +// go tool pprof 'localhost:6060/debug/pprof/wit_pprof_experiment_thing?debug=1' +// +// https://medium.com/@cep21/creating-custom-go-profiles-with-pprof-b737dfc58e11 + +import "fmt" +import "log" +import "net/http" +import _ "net/http/pprof" // the _ means only the init() is needed +import "os" +import "runtime/pprof" +import "sync/atomic" +import "time" + +var libProfile *pprof.Profile + +func init() { + profName := "wit_pprof_experiment_thing" // this ends up in the URL + libProfile = pprof.Lookup(profName) + if libProfile == nil { + libProfile = pprof.NewProfile(profName) + } +} + +type someResource struct { + *os.File +} + +var fileIndex = int64(0) + +func MustResource() *someResource { + f, err := os.Create(fmt.Sprintf("/tmp/%d.txt", atomic.AddInt64(&fileIndex, 1))) + if err != nil { + panic(err) + } + r := &someResource{f} + libProfile.Add(r, 1) + return r +} + +func (r *someResource) Close() error { + libProfile.Remove(r) + return r.File.Close() +} + +func trackAFunction() { + tracked := new(byte) + libProfile.Add(tracked, 1) + defer libProfile.Remove(tracked) + time.Sleep(time.Second) +} + +func usesAResource() { + res := MustResource() + defer res.Close() + for i := 0; i < 10; i++ { + time.Sleep(time.Second) + } +} + +func pprofMain() { + http.HandleFunc("/nonblock", func(rw http.ResponseWriter, req *http.Request) { + go usesAResource() + }) + http.HandleFunc("/functiontrack", func(rw http.ResponseWriter, req *http.Request) { + trackAFunction() + }) + http.HandleFunc("/block", func(rw http.ResponseWriter, req *http.Request) { + usesAResource() + }) + log.Println("run this and then hit:") + log.Println("http://localhost:6061/debug/pprof/") + log.Println("") + log.Println("Running!") + log.Println(http.ListenAndServe("localhost:6061", nil)) +} diff --git a/resources/VERSION b/resources/VERSION new file mode 100644 index 0000000..085135e --- /dev/null +++ b/resources/VERSION @@ -0,0 +1 @@ +v0.1 diff --git a/resources/apt/Makefile b/resources/apt/Makefile new file mode 100644 index 0000000..5b43d19 --- /dev/null +++ b/resources/apt/Makefile @@ -0,0 +1,44 @@ +setup-packages-kernel-build: + apt install -y flex bison dwarves libelf-dev + +setup-packages-steam: + dpkg --add-architecture i386 + apt update + apt install -f mesa-utils + apt install -f steam + +setup-packages-desktop: + @echo tasksel + @echo make steam + @echo make chrome + @echo apt install xchat + @echo apt install blender + @echo apt install virt-manager + @echo apt remove minissdpd --purge + apt install remmina* synergy + +setup-packages-laptop: + apt install pm-utils + +# https://looking-glass.io/docs/stable/build/ +setup-kvm-windows-looking-glass: + apt install binutils-dev cmake fonts-freefont-ttf libfontconfig1-dev libegl-dev libspice-protocol-dev nettle-dev libx11-dev libxi-dev libxinerama-dev libxss-dev libwayland-dev wayland-protocols + git clone --recursive https://github.com/gnif/LookingGlass.git + +setup-install-google-chrome: + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1397BC53640DB551 + cp google-chrome.list /etc/apt/sources.list.d/ + apt update + apt install google-chrome-stable + +# WARNING: Firmware can not be updated in legacy BIOS mode +# See https://github.com/fwupd/fwupd/wiki/PluginFlag:legacy-bios for more information. +# No hardware detected with firmware update capability +# This warning can be ignored if UEFI firmware updates are not desired. It can be disabled by adding +# DisabledPlugins=test;invalid;uefi +# to /etc/fwupd/daemon.conf or by recompiling without UEFI support. +setup-firmware-fwupd: + apt install fwupdate fwupd + fwupdmgr get-devices + fwupdmgr refresh + fwupdmgr get-updates diff --git a/resources/apt/sources.list b/resources/apt/sources.list new file mode 100644 index 0000000..0018c93 --- /dev/null +++ b/resources/apt/sources.list @@ -0,0 +1,23 @@ +deb http://mirrors.wit.org/debian/ sid main contrib non-free +deb-src http://mirrors.wit.org/debian/ sid main contrib non-free + +# deb http://deb.debian.org/debian experimental main +# apt -t experimental install xrandr + +# INFO: http://deb.debian.org/ +# NO_PUBKEY 5A88D659DCB811BB +# deprecated: apt-key adv --keyserver keyring.debian.org --recv-keys 5A88D659DCB811BB +# use: apt install debian-ports-archive-keyring +deb http://deb.debian.org/debian unstable main contrib non-free +deb http://deb.debian.org/debian-debug unstable-debug main contrib non-free +deb http://deb.debian.org/debian-ports unstable main contrib non-free + +###################### apt fallback to cogentco.com ########################### +#deb http://mirror.cogentco.com/debian/ sid main contrib non-free +#deb-src http://mirror.cogentco.com/debian/ sid main contrib non-free +############################################################################# + +###################### apt fallback to kernel.org ########################### +#deb http://mirrors.kernel.org/debian/ sid main contrib non-free +#deb-src http://mirrors.kernel.org/debian/ sid main contrib non-free +############################################################################# diff --git a/resources/apt/wit-org.list b/resources/apt/wit-org.list new file mode 100644 index 0000000..bd8c5a1 --- /dev/null +++ b/resources/apt/wit-org.list @@ -0,0 +1,2 @@ +deb http://mirrors.wit.org/wit/ sid main +deb-src http://mirrors.wit.org/wit/ sid main diff --git a/resources/bin/apt-file.sh b/resources/bin/apt-file.sh new file mode 100755 index 0000000..700d866 --- /dev/null +++ b/resources/bin/apt-file.sh @@ -0,0 +1,5 @@ +#!/bin/bash -x + +apt -y install apt-file +apt-file update +apt-file -x search '/pingus$' diff --git a/resources/bin/games.sh b/resources/bin/games.sh new file mode 100755 index 0000000..533b65f --- /dev/null +++ b/resources/bin/games.sh @@ -0,0 +1,30 @@ +#!/bin/bash -x + +apt install -y flightgear +apt install -y 0ad +apt install -y extremetuxracer # TODO: test fps at 4096x4096 with xrandr +apt install -y neverball + +apt install -y \ + hedgewars \ + sauerbraten \ + warzone2100 \ + bzflag \ + wesnoth + +apt install -y pingus \ + supertux \ + assaultcube \ + supertuxkart \ + xgalaga \ + open-invaders \ + freeciv \ + lincity-ng \ + scorched3d \ + + # corsix-th + # openttd fluid-soundfont-gs fluidsynth openttd-opensfx freepats pmidi timidity-daemon + + # add-apt-repository https://dl.bintray.com/mmatyas/deb + # apt-get update + # apt-get install openblok diff --git a/resources/bin/install-applications.sh b/resources/bin/install-applications.sh new file mode 100755 index 0000000..ac558d7 --- /dev/null +++ b/resources/bin/install-applications.sh @@ -0,0 +1,89 @@ +#!/bin/bash -x + +apt install -y stacer # Linux system optimizer and monitoring +apt install -y timeshift # System restore utility +apt install -y gnucash # personal and small-business financial-accounting software +apt install -y remmina* # GTK+ Remote Desktop Client + +apt install -y texstudio # LaTeX Editor +apt install -y gimagereader \ + tesseract-ocr-eng \ + tesseract-ocr-fra # really excellent OCR (multiple languages) + +apt install -y evolution # email / calendar +apt install -y firefox +apt install -y thunderbird # mail/news client +apt install -y pan # newsreader +apt install -y qbittorrent # bittorrent client based on libtorrent-rasterbar with a Qt5 GUI +apt install -y deluge # bittorrent client written in Python/PyGTK +apt install -y transmission # lightweight BitTorrent client +apt install -y \ + telegram-desktop \ + telegram-purple \ + telegram-cli # fast and secure messaging application +apt install -y keepassxc # password manager (FOSS app built on qt5) +apt install -y calamares \ + calamares-settings-debian # the gnome installer + +apt install -y gimp # fucking excellent 2D +apt install -y krita # a different gimp +apt install -y blender # fucking excellent 3D +apt install -y inkscape # page layout +apt install -y valentina # pattern making program + +# chat clients +apt install -y gajim # GTK+-based Jabber client // looks very modern +apt install -y hexchat # IRC client for X based on X-Chat 2 +apt install -y pidgin # multi-protocol instant messaging client +apt install -y profanity # console based XMPP client // pretty modern website for a ncurses app +apt install -y psi # Qt-based XMPP client +apt install -y kaidan # Simple and user-friendly Jabber/XMPP client (old?) + +# chat servers +apt install -y ejabberd # extensible realtime platform (XMPP server + MQTT broker + SIP service +apt install -y ejabberd-mod-grapfite # ejabberd module to gather statistics and publish them via statsd/grafite +apt install -y jabber2 # Jabber instant messenger server +apt install -y prosody # Lightweight Jabber/XMPP server + +# audo +apt install -y audacity # multi-track audio editor +apt install -y ardour # the digital audio workstation +apt install -y audacious # small and fast audio player + +######################### video ############################ +apt install -y mpv # looks like it's the future of mplayer & mencoder +apt install -y mplayer # movie player for Unix-like systems +apt install -y vlc # multimedia player and streamer + +apt install -y pitivi # non-linear audio/video editor +apt install -y openshot # OpenShot Video Editor +apt install -y shotcut # video editor with features like 4k +apt install -y olive-editor # non-linear video editor +apt install -y lmms # Linux Multimedia Studio +apt install -y kdenlive # non-linear video editing suite +apt install -y kodi # Open Source Home Theatre + +apt install -y handbrake # convert anything to anything else + +apt install -y obs-studio # designed for efficiently recording and streaming live video +apt install -y flameshot # simple-to-use screenshot software +apt install -y peek # a screen recorder +apt install -y kazam # screencast and screenshot application +##################### video end ############################ + +apt install -y wireshark # deep network traffic analyzer +apt install -y termshark # golang Terminal UI for wireshark +apt install -y testdisk # disk partition map and recovery tool + +# funny terminal window screen saver +# add-apt-repository ppa:ytvwld/asciiquarium +# apt-get update && sudo apt-get install asciiquarium + + +apt install -y youtube-dl +apt install -y youtubedl-gui # GUI on youtube-dl + +# synergy + +# clamav clamtk # anti-virus utility for Unix +# lightworks : https://www.lwks.com/ diff --git a/resources/bin/install-default-packages.sh b/resources/bin/install-default-packages.sh new file mode 100755 index 0000000..0fc464d --- /dev/null +++ b/resources/bin/install-default-packages.sh @@ -0,0 +1,7 @@ +#!/bin/bash -x + +# Stuff I always want installed. Not much. 200MB (?) + +apt install -y lsof bash-completion libpam-systemd dbus rbd-nbd golang-go git screen vim ethstatus iftop ethtool sysstat +apt install -y traceroute whois devscripts automake libtool devscripts nmap clang rsync bind9utils dnsutils net-tools +apt install -y tcpdump wget curl iputils-ping pciutils iptables sysbench man usbutils ssh neofetch bc lshw telnet hdparm vrms diff --git a/resources/bin/steam.sh b/resources/bin/steam.sh new file mode 100755 index 0000000..9d1ef70 --- /dev/null +++ b/resources/bin/steam.sh @@ -0,0 +1,6 @@ +#!/bin/bash -x + +dpkg --add-architecture i386 +apt update +apt install -f mesa-utils +apt install -f steam diff --git a/resources/resolv/resolv-1-1-1-1.conf b/resources/resolv/resolv-1-1-1-1.conf new file mode 100644 index 0000000..e998672 --- /dev/null +++ b/resources/resolv/resolv-1-1-1-1.conf @@ -0,0 +1,4 @@ +# Generated by jcarr +domain lab.wit.org +search lab.wit.org +nameserver 1.1.1.1 diff --git a/resources/resolv/resolv-4.2.2.2.conf b/resources/resolv/resolv-4.2.2.2.conf new file mode 100644 index 0000000..7a58bb9 --- /dev/null +++ b/resources/resolv/resolv-4.2.2.2.conf @@ -0,0 +1,4 @@ +# Generated by jcarr +domain lab.wit.org +search lab.wit.org +nameserver 4.2.2.2 # as of 2021/06/05 does not resolve *.lab.wit.org diff --git a/resources/resolv/resolv-8-8-8-8.conf b/resources/resolv/resolv-8-8-8-8.conf new file mode 100644 index 0000000..bba2290 --- /dev/null +++ b/resources/resolv/resolv-8-8-8-8.conf @@ -0,0 +1,4 @@ +# Generated by jcarr +domain lab.wit.org +search lab.wit.org +nameserver 8.8.8.8 diff --git a/resources/resolv/resolv-ipv6-only.conf b/resources/resolv/resolv-ipv6-only.conf new file mode 100644 index 0000000..4efd314 --- /dev/null +++ b/resources/resolv/resolv-ipv6-only.conf @@ -0,0 +1,7 @@ +# Generated by jcarr +domain lab.wit.org +search lab.wit.org + +# google's dns: +nameserver 2001:4860:4860::6464 +nameserver 2001:4860:4860::8888 diff --git a/resources/resolv/resolv-localhost.conf b/resources/resolv/resolv-localhost.conf new file mode 100644 index 0000000..f536e95 --- /dev/null +++ b/resources/resolv/resolv-localhost.conf @@ -0,0 +1,8 @@ +# bind.wit.org (a nameserver) should +# always use itself as the nameserver +# I'm not sure, but strange things seem +# to happen sometimes if you don't -- jcarr + +domain lab.wit.org +search lab.wit.org +nameserver 127.0.0.1 diff --git a/systray.go b/systray.go new file mode 100644 index 0000000..09fd620 --- /dev/null +++ b/systray.go @@ -0,0 +1,148 @@ +package main + +import "fmt" +import "os" +import "io/ioutil" +import "log" +import "time" + +import "git.wit.org/wit/gui" +import "github.com/davecgh/go-spew/spew" +import "github.com/getlantern/systray" +// "github.com/skratchdot/open-golang/open" + +func systrayMain() { + onExit := func() { + fmt.Println("Starting onExit") + + now := time.Now() + ioutil.WriteFile(fmt.Sprintf(`/tmp/on_exit_%d.txt`, now.UnixNano()), []byte(now.String()), 0644) + now = time.Now() + ioutil.WriteFile(fmt.Sprintf(`/tmp/on_exit_%d.2.txt`, now.UnixNano()), []byte(now.String()), 0644) + + fmt.Println("Finished onExit") + } + // Should be called at the very beginning of main(). + systray.Run(onReady, onExit) +} + +var mHide *systray.MenuItem +var mShow *systray.MenuItem +var mChecked *systray.MenuItem + +func onReady() { + systray.SetIcon(myIcon) + systray.SetTitle("Awesome App") + systray.SetTooltip("Lantern") + mDump := systray.AddMenuItem("Debug Window", "Debug Window") + /* + mQuitOrig := systray.AddMenuItem("Quit", "Quit the whole app") + go func() { + <-mQuitOrig.ClickedCh + fmt.Println("Requesting quit") + systray.Quit() + fmt.Println("Finished quitting") + }() + */ + + var c = 0 + // We can manipulate the systray in other goroutines + go func() { + systray.SetIcon(myIcon) + systray.SetTitle("Awesome App") + systray.SetTooltip("Pretty awesome棒棒嗒") + + mShow = systray.AddMenuItem("Show 640x480", "Show 480") + mHide = systray.AddMenuItem("Hide Window", "Hide Window") + + mChange := systray.AddMenuItem("Change Me", "Change Me") + mChecked = systray.AddMenuItem("Unchecked", "Check Me") + mEnabled := systray.AddMenuItem("Enabled", "Enabled") + mUrl := systray.AddMenuItem("Open Lantern.org", "my home") + // mQuit := systray.AddMenuItem("退出", "Quit the whole app") + mQuit := systray.AddMenuItem("Quit", "Quit the whole app") + + // Sets the icon of a menu item. Only available on Mac. + mQuit.SetIcon(myIcon) + + systray.AddSeparator() + mToggle := systray.AddMenuItem("Toggle", "Toggle the Quit button") + shown := true + // var blah struct{int} + // blah := make(chan struct{}) + for { + select { + case <-mChange.ClickedCh: + log.Println("START") + log.Println("END") + mChange.SetTitle("I've Changed") + case <-mChecked.ClickedCh: + log.Println("CHECKED START") + if mChecked.Checked() { + mChecked.Uncheck() + mChecked.SetTitle("Unchecked") + log.Println("UNCHECKED") + } else { + mChecked.Check() + mChecked.SetTitle("Checked") + log.Println("CHECKED") + } + spew.Dump(mChecked.ClickedCh) + log.Println("CHECKED END") + case <-mDump.ClickedCh: + log.Println("START") + gui.Config.Width = 800 + gui.Config.Height = 300 + gui.Queue(gui.DebugWindow) + log.Println("END") + case <-mShow.ClickedCh: + log.Println("START Show()") + gui.Config.Width = 640 + c*20 + c = c + 1 + gui.Config.Height = 480 + gui.Queue(gui.DebugWindow) + log.Println("END") + case <-mHide.ClickedCh: + log.Println("START Hide()") + /* + window := gui.Data.WindowMap["splash"] + if window != nil { + box := window.BoxMap["splash"] + box.Window.UiTab.Hide() + } + */ + log.Println("END") + case <-mEnabled.ClickedCh: + log.Println("START") + mEnabled.SetTitle("Disabled") + mEnabled.Disable() + log.Println("END") + case <-mUrl.ClickedCh: + log.Println("START") + // open.Run("https://www.getlantern.org") + log.Println("END") + case <-mToggle.ClickedCh: + log.Println("START") + if shown { + // mQuitOrig.Hide() + mEnabled.Hide() + shown = false + } else { + // mQuitOrig.Show() + mEnabled.Show() + shown = true + } + log.Println("END") + // os.Exit(0) + case <-mQuit.ClickedCh: + log.Println("START") + log.Println("Systray Quit now...") + systray.Quit() + log.Println("END") + log.Println("os.Exit() now...") + os.Exit(0) + return + } + } + }() +} diff --git a/tioc_bsd.go b/tioc_bsd.go new file mode 100644 index 0000000..5ceb20c --- /dev/null +++ b/tioc_bsd.go @@ -0,0 +1,12 @@ +// +build darwin freebsd dragonfly openbsd netbsd + +// https://github.com/creack/termios/blob/master/raw/tioc_bsd.go + +package raw + +import "syscall" + +const ( + getTermios = syscall.TIOCGETA + setTermios = syscall.TIOCSETA +) diff --git a/watch.go b/watch.go new file mode 100644 index 0000000..73a702d --- /dev/null +++ b/watch.go @@ -0,0 +1,90 @@ +// a custom build target for go +//go:generate go get -v github.com/tv42/becky +//go:generate go install github.com/tv42/becky +//go:generate becky README.md + +package main + +import ( + "log" + "runtime/debug" + "time" + +// "git.wit.org/wit/gui" +) + +type myChan struct { + Width int + Height int +} + +// This goroutine will +func watchWindows() { + var i = 1 + for { + log.Println("wait for GUI exit()", i) + i += 1 + time.Sleep(loopsleep * time.Second / 10) + // dotest() + if closed { + log.Println("Window was closed") + + /* + if dnsSlider == nil { + log.Println("SKIPPING: dnsSlider == nil") + } else { + dnsSlider.SetValue(55) + } + */ + // gui.CreateWindow("ARGV", "vars", 300, 200, makeWindowARGV) + + debug.PrintStack() + dumpModuleInfo() +/* + gui.DumpBoxes() + window := gui.Data.WindowMap["Debugging2"] + if window != nil { + log.Println("found debugging2 Window") + gui.DeleteWindow("Debugging2") + } else { + closed = false + } +*/ + + // toggle the systray menu + var tmp struct{} + log.Println("is mChecked uninitialized:", mChecked == nil) + if mChecked != nil { + log.Println("is mChecked.ClickedCh uninitialized:", mChecked.ClickedCh == nil) + if mChecked.ClickedCh != nil { + mChecked.ClickedCh <- tmp // signal the main goroutine + } + } + } + } +} + +func dumpModuleInfo() { + tmp, _ := debug.ReadBuildInfo() + if tmp == nil { + log.Println("This wasn't compiled with go module support") + return + } + log.Println("mod.Path = ", tmp.Path) + log.Println("mod.Main.Path = ", tmp.Main.Path) + log.Println("mod.Main.Version = ", tmp.Main.Version) + log.Println("mod.Main.Sum = ", tmp.Main.Sum) + for _, value := range tmp.Deps { + log.Println("\tmod.Path = ", value.Path) + log.Println("\tmod.Version = ", value.Version) + } +} + +func dumbLoop() { + var i = 1 + for { + log.Println("dumb GUI loop ", i) + i += 1 + time.Sleep(2 * time.Second) + } +} diff --git a/window-debug-golang.go b/window-debug-golang.go new file mode 100644 index 0000000..cc5509f --- /dev/null +++ b/window-debug-golang.go @@ -0,0 +1,88 @@ +package main + +import ( +// "bufio" + "log" + "os" + "runtime" + "runtime/debug" + "runtime/pprof" +) +import "git.wit.org/wit/gui" + +func golangDebug(w *gui.Node) { + if (w == nil) { + gui.Config.Title = "golangDebug Window" + gui.Config.Width = 100 + gui.Config.Height = 100 + gui.Config.Exit = customExit + w = gui.NewWindow() + } + + tab := w.AddTab("golangDebug()", nil) + + /////////////////////////////// Column DEBUG GOLANG ////////////////////// + gNode := tab.AddGroup("golang") + + gNode.AddButton("runtime.Stack() dump", func (*gui.Node) { + log.Println("\tSTART") + buf := make([]byte, 1<<16) + runtime.Stack(buf, true) + log.Printf("%s", buf) + log.Println("\tEND") + }) + gNode.AddButton("dumpModuleInfo", func (*gui.Node) { + log.Println("\tSTART") + dumpModuleInfo() + log.Println("\tEND") + }) + gNode.AddButton("debug.PrintStack", func (*gui.Node) { + log.Println("\tSTART") + debug.PrintStack() + log.Println("\tEND") + }) + gNode.AddButton("pprof.Lookup goroutine", func (*gui.Node) { + log.Println("\tSTART") + pprof.Lookup("goroutine").WriteTo(os.Stdout, 1) + log.Println("\tEND") + }) + gNode.AddButton("pprof.Lookup", func (*gui.Node) { + log.Println("\tSTART") + pprof.Lookup("heap").WriteTo(os.Stdout, 1) + log.Println("\tEND") + }) + gNode.AddButton("pprof.Lookup block", func (*gui.Node) { + log.Println("\tSTART") + pprof.Lookup("block").WriteTo(os.Stdout, 1) + log.Println("\tEND") + }) + gNode.AddButton("pprof.Lookup threadcreate", func (*gui.Node) { + log.Println("\tSTART") + pprof.Lookup("threadcreate").WriteTo(os.Stdout, 1) + log.Println("\tEND") + }) + gNode.AddButton("runtime.ReadMemStats", func (*gui.Node) { + var s runtime.MemStats + runtime.ReadMemStats(&s) + log.Printf("alloc: %v bytes\n", s.Alloc) + log.Printf("total-alloc: %v bytes\n", s.TotalAlloc) + log.Printf("sys: %v bytes\n", s.Sys) + log.Printf("lookups: %v\n", s.Lookups) + log.Printf("mallocs: %v\n", s.Mallocs) + log.Printf("frees: %v\n", s.Frees) + log.Printf("heap-alloc: %v bytes\n", s.HeapAlloc) + log.Printf("heap-sys: %v bytes\n", s.HeapSys) + log.Printf("heap-idle: %v bytes\n", s.HeapIdle) + log.Printf("heap-in-use: %v bytes\n", s.HeapInuse) + log.Printf("heap-released: %v bytes\n", s.HeapReleased) + log.Printf("heap-objects: %v\n", s.HeapObjects) + log.Printf("stack-in-use: %v bytes\n", s.StackInuse) + log.Printf("stack-sys: %v bytes\n", s.StackSys) + log.Printf("next-gc: when heap-alloc >= %v bytes\n", s.NextGC) + log.Printf("last-gc: %v ns\n", s.LastGC) + log.Printf("gc-pause: %v ns\n", s.PauseTotalNs) + log.Printf("num-gc: %v\n", s.NumGC) + log.Printf("enable-gc: %v\n", s.EnableGC) + log.Printf("debug-gc: %v\n", s.DebugGC) + }) +} diff --git a/window-debug.go b/window-debug.go new file mode 100644 index 0000000..9ace895 --- /dev/null +++ b/window-debug.go @@ -0,0 +1,100 @@ +package main + +import ( + "log" +// "bufio" +// "os" + "runtime" +// "runtime/debug" +// "runtime/pprof" +// "time" + + "git.wit.org/wit/gui" +// "git.wit.org/wit/shell" + +// "github.com/andlabs/ui" +// _ "github.com/andlabs/ui/winmanifest" +) + +// var jcarrtest *gui.GuiBox +// var jcarrnode *gui.Node + +// TODO: convert this so it works in a tab +func showSplashTab(n *gui.Node) *gui.Node { + log.Println("ShowSplashBox() START") + + // box.Window.UiWindow.SetTitle("Debugging2") + + ny1 := n.AddHorizontalBox("tile1") + ny1.NewLabel("bar") + + ny1.NewLabel("OS: "+runtime.GOOS) + ny1.NewLabel("Version: "+VERSION) + ny1.NewLabel("git commit: "+GITCOMMIT) + ny1.NewLabel("GO Version: "+GOVERSION) + + ny1.AddButton("Delete tab 0", func(*gui.Node) { + // n.UiTab.Delete(0) + }) + + // log.Println("ShowSplashBox() END box =", box) + return ny1 +} + +func runTestExecClick(n *gui.Node) { + log.Println("runTestExecClick START") + if runtime.GOOS == "linux" { + var tmp []string + tmp = append(tmp, "nohup", "xterm") + go runCommand(tmp) + // go runSimpleCommand("xterm -report-fonts") + } else if runtime.GOOS == "windows" { + go runSimpleCommand("mintty.exe") + } else { + var tmp []string + tmp = append(tmp, "nohup", "xterm") + go runCommand(tmp) + } + log.Println("runTestExecClick END") +} + +func populateDebugTab(n *gui.Node) { + log.Println("debugClick() START") + + /////////////////////////////// Column BLAH /////////////////////////////// + gNode := n.AddGroup("blah") + + gNode.AddButton("bash", runTestExecClick) + gNode.AddButton("ping", func (*gui.Node) { + hostname := "localhost" + xterm("ping " + hostname) + }) + gNode.AddButton("systrayMain", func (*gui.Node) { + go systrayMain() + }) + + /////////////////////////////// Column DEBUG GUI ///////////////////////// + gNode.AddButton("closed = true", func (*gui.Node) { + closed = true + }) + gNode.AddButton("closed = false", func (*gui.Node) { + closed = false + }) + gNode.AddButton("loopsleep = 2", func (*gui.Node) { + loopsleep = 2 + }) + gNode.AddButton("toggle systray menu", func (*gui.Node) { + var tmp struct{} + // log.Println("is tmp uninitialized:", tmp == nil) + log.Println("is mChecked uninitialized:", mChecked == nil) + if mChecked != nil { + log.Println("is mChecked.ClickedCh uninitialized:", mChecked.ClickedCh == nil) + if mChecked.ClickedCh != nil { + mChecked.ClickedCh <- tmp // signal the main goroutine + } + } + }) + + // FIXME: need correct args + // gNode.CreateColorButton("COLOR73", "COLOR73", nil) +} diff --git a/window-dns-update.go b/window-dns-update.go new file mode 100644 index 0000000..e3d0035 --- /dev/null +++ b/window-dns-update.go @@ -0,0 +1,37 @@ +package main + +// import "os" +// import "log" +// import "strconv" +// import "io/ioutil" +// import "bufio" +import "git.wit.org/wit/gui" + +func updateDNS(w *gui.Node) { + if (w == nil) { + gui.Config.Title = "dns update Window" + gui.Config.Width = 110 + gui.Config.Height = 110 + gui.Config.Exit = customExit + w = gui.NewWindow() + } + + tab := w.AddTab("updateDNS()", nil) + // populateNEW(tab, "new") + +////////////// filename ///////////////////////// + gNode := tab.AddGroup("eth0 update") + // fontsize := "16" + + dnsNode := gNode.AddComboBox("8", + "16", + "24") + + dnsNode.SetText("12") + +////////////// connect ///////////////////////// + gNode = tab.AddGroup("Update") + + gNode.AddButton("setup .Xresources", func (*gui.Node) { + }) +} diff --git a/window-main.go b/window-main.go new file mode 100644 index 0000000..e107017 --- /dev/null +++ b/window-main.go @@ -0,0 +1,48 @@ +package main +import ( "log" + + "git.wit.org/wit/gui" +) + +func mainWindow(w *gui.Node) *gui.Node { + if (w == nil) { + gui.Config.Title = "Main Personal GUI Window" + gui.Config.Width = 101 + gui.Config.Height = 101 + w = gui.NewWindow() + } + + newTab := w.AddTab("MAIN TAB", nil) + + ////////////////////////// MAIN //////////////////////////////// + g1 := newTab.AddGroup("Windows") + + g1.AddButton("resolv.conf", func (*gui.Node) { + log.Println("supposed to make the resolv.conf window") + resolvWindow(nil) + }) + g1.AddButton("Generic SSH Window", func (*gui.Node) { + sshGenericWindow(nil) + }) + + g1.AddButton("update DNS (IPv6)", func (*gui.Node) { + updateDNS(nil) + }) + + g1.AddButton("tabResets()", func (*gui.Node) { + tabResets(w) + }) + + g1.AddButton("www url's", func (*gui.Node) { + windowAddWWW(nil) + }) + + ////////////////////////// TABS //////////////////////////////// + g2 := newTab.AddGroup("Tabs") + + g2.AddButton("GO language debuggging", func (*gui.Node) { + golangDebug(w) + }) + + return newTab +} diff --git a/window-resets.go b/window-resets.go new file mode 100644 index 0000000..d24211b --- /dev/null +++ b/window-resets.go @@ -0,0 +1,63 @@ +package main +import ( "log" + + "git.wit.org/wit/gui" +) + +func tabResets(w *gui.Node) *gui.Node { + if (w == nil) { + gui.Config.Title = "resets window" + gui.Config.Width = 240 + gui.Config.Height = 280 + gui.Config.Exit = customExit + w = gui.NewWindow() + } + + newTab := w.AddTab("tabResets()", nil) + + ///////////////////////////////////////////////////////////////////////////// + gNode2 := newTab.AddGroup("reset windows") + + gNode2.NewLabel("Working Stuff") + + gNode2.AddButton("resolv.conf", func (*gui.Node) { + log.Println("supposed to make the resolv.conf window") + resolvWindow(nil) + }) + + gNode2.AddButton("Set xterm Font Size", func (*gui.Node) { + // gui.CreateWindow("Set xterm Font Size", "vars", 200, 200, makeWindowXresources) + xtermSettings(w) + }) + + ///////////////////////////////////////////////////////////////////////////// + resetsNode := newTab.AddGroup("apt Resets") + + resetsNode.AddButton("apt sources", func (*gui.Node) { + xterm("apt -y install apt-file; apt-file update") + }) + resetsNode.AddButton("purge rc-only", func (*gui.Node) { + xterm("dpkg -l |grep ^rc | awk '{print $2}' |xargs apt remove --purge -y") + }) + resetsNode.AddButton("install defaults", func (*gui.Node) { + xterm("./resources/bin/setup-packages-default") + }) + resetsNode.AddButton("install kvm", func (*gui.Node) { + xterm("./resources/bin/setup-packages-kvm") + }) + + ///////////////////////////////////////////////////////////////////////////// + gn := newTab.AddGroup("GO") + gn.AddButton("go install golang.org/x/tools/gopls@latest", func (*gui.Node) { + xterm("go install golang.org/x/tools/gopls@latest") + }) + gn.AddButton("vim-go clone", func (*gui.Node) { + xterm("git clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go") + }) + gn.AddButton("vim-go vimrc settings", func (*gui.Node) { + log.Println("echo", "let g:go_def_mode='gopls'\nlet g:go_info_mode='gopls'") + // xterm("echo", "let g:go_def_mode='gopls'\nlet g:go_info_mode='gopls'") + }) + + return newTab +} diff --git a/window-resolv.go b/window-resolv.go new file mode 100644 index 0000000..fbc9a31 --- /dev/null +++ b/window-resolv.go @@ -0,0 +1,57 @@ +package main + +import "log" +import "os" +import "bufio" +import "git.wit.org/wit/gui" + +func resolvWindow(w *gui.Node) { + if (w == nil) { + gui.Config.Title = "resolv.conf Window" + gui.Config.Width = 113 + gui.Config.Height = 112 + gui.Config.Exit = customExit + w = gui.NewWindow() + } + + tab := w.AddTab("resolv.conf Tab", nil) + // populateNEW(tab, "new") + +////////////// filename ///////////////////////// + gNode := tab.AddGroup("filename") + + resolvNode := gNode.AddComboBox("resolv-1-1-1-1.conf", + "resolv-4.2.2.2.conf", + "resolv-8-8-8-8.conf", + "resolv-bind.wit.org.conf", + "resolv-ipv6-only.conf", + "resolv-localhost.conf") + + resolvNode.SetText("resolv-1-1-1-1.conf") + resolvNode.OnChanged = func () { + log.Println("STARTED HOSTNAME") + filename := resolvNode.GetText() + log.Println("ENDED GetText() HOSTNAME =", filename) + } + +////////////// connect ///////////////////////// + gNode = tab.AddGroup("Update") + + gNode.AddButton("/etc/resolv.conf", func (*gui.Node) { + filename := "resolv/" + resolvNode.GetText() + log.Println("set resolv.conf to",filename) + b, _ := packrBox.FindString(filename) + log.Println(filename, "=\n\n" + b) + // spew.Dump(b) + + f, err := os.Create("/etc/resolv.conf") + if err != nil { + return + } + defer f.Close() + w := bufio.NewWriter(f) + n4, err := w.WriteString(b) + log.Println("n4 =", n4) + w.Flush() + }) +} diff --git a/window-ssh-generic.go b/window-ssh-generic.go new file mode 100644 index 0000000..0f61977 --- /dev/null +++ b/window-ssh-generic.go @@ -0,0 +1,80 @@ +package main + +import "log" +import "reflect" +import "git.wit.org/wit/gui" + +var userNode *gui.Node + +func sshGenericWindow(w *gui.Node) { + if (w == nil) { + gui.Config.Title = "sshWindow" + gui.Config.Width = 101 + gui.Config.Height = 131 + gui.Config.Exit = customExit + w = gui.NewWindow() + } + + tab := w.AddTab("sshWindow()", nil) + // populateNEW(tab, "new") + +////////////// username ///////////////////////// + gNode := tab.AddGroup("username") + + userNode = gNode.AddComboBox("username", + "root", + "jcarr", + "hugo") + + userNode.SetText("something") + userNode.OnChanged = func () { + username = userNode.GetText() + log.Println("SETTING: username=", username) + userNode.Dump() + // panic("blah") + } + userNode.Dump() + // panic("blah") + +////////////// hostname ///////////////////////// + gNode = tab.AddGroup("homename") + + hostNode := gNode.AddComboBox("hostname", + "fire.lab.wit.org", + "www.wit.org", + "bind.wit.org", + "ns1.wit.com", + "ns2.wit.com") + + hostNode.SetText("fire") + hostNode.OnChanged = func () { + log.Println("STARTED HOSTNAME") + hostname = hostNode.GetText() + log.Println("ENDED GetText() HOSTNAME") + } + +////////////// connect ///////////////////////// + gNode = tab.AddGroup("connect") + + gNode.AddButton("connect", func (*gui.Node) { + cmd := "ssh -v " + username + "@" + hostname + log.Println("xterm cmd=", cmd) + xterm(cmd) + }) +} + +func makeSSHbutton (n *gui.Node, name string, hostname string) { + bNode := n.AddButton(name, func (*gui.Node) { + var tmp []string + if (username == "") { + username = "root" + } + junk := "ssh -v " + username + "@" + hostname + log.Println("junk = " , junk) + log.Println("username = '" + username + "'") + xterm(junk) + log.Println("tmp = " , reflect.ValueOf(tmp).Kind()) + // spew.Dump(tmp) + }) + bNode.Dump() +} diff --git a/window-www.go b/window-www.go new file mode 100644 index 0000000..beb2eeb --- /dev/null +++ b/window-www.go @@ -0,0 +1,50 @@ +package main + +import "log" +// import "reflect" +import "git.wit.org/wit/gui" + +import "github.com/skratchdot/open-golang/open" + +func windowAddWWW(w *gui.Node) { + if (w == nil) { + gui.Config.Title = "webpages" + gui.Config.Width = 102 + gui.Config.Height = 102 + w = gui.NewWindow() + } + + tab := w.AddTab("start www", nil) + +////////////// connect ///////////////////////// + gNode := tab.AddGroup("www") + urlButton(gNode, "git", "https://git.wit.org/") + urlButton(gNode, "mirrors", "https://mirrors.wit.org/") + urlButton(gNode, "ping.wit.com 6", "http://ping.wit.com/") + urlButton(gNode, "pprof localhost", "http://localhost:6060/debug/pprof/") +} + +func firefoxButton (n *gui.Node, name string, url string) { + n.AddButton(name, func (*gui.Node) { + log.Println("button clicked: trying to open url") + // cmd := "--new-window http://192.168.100.1/" + var tmp []string + tmp = append(tmp, "nohup") + tmp = append(tmp, firefox...) + tmp = append(tmp, url) + go runCommand(tmp) + }) + // bNode.Dump() +} + +func urlButton (n *gui.Node, name string, url string) { + if (useFirefox == true) { + firefoxButton(n, name, url) + } else { + bNode := n.AddButton(name, func (*gui.Node) { + log.Println("button clicked: trying to open url =", url) + open.Run(url) + }) + bNode.Dump() + } +} diff --git a/window-xterm-fontsize.go b/window-xterm-fontsize.go new file mode 100644 index 0000000..182adc6 --- /dev/null +++ b/window-xterm-fontsize.go @@ -0,0 +1,52 @@ +package main + +import "log" +// import "strconv" +import "io/ioutil" +import "git.wit.org/wit/gui" + +func xtermSettings(w *gui.Node) { + if (w == nil) { + gui.Config.Title = "xterm font setting" + gui.Config.Width = 105 + gui.Config.Height = 105 + gui.Config.Exit = customExit + w = gui.NewWindow() + } + + tab := w.AddTab("xtermSettings()", nil) + // populateNEW(tab, "new") + +////////////// filename ///////////////////////// + gNode := tab.AddGroup("filename") + fontsize := "16" + + resolvNode := gNode.AddComboBox("8", + "16", + "24") + + resolvNode.SetText("12") + resolvNode.OnChanged = func () { + log.Println("STARTED HOSTNAME") + fontsize = resolvNode.GetText() + log.Println("ENDED GetText() HOSTNAME =", fontsize) + } + +////////////// connect ///////////////////////// + gNode = tab.AddGroup("Update") + + gNode.AddButton("setup .Xresources", func (*gui.Node) { + log.Println("fontsize =", fontsize) + + // write out .Xresources file + foo := []byte("xterm*faceName: Monospace\nxterm*faceSize: ") + // bar := []byte(strconv.Itoa(fontsize) + "\n") + bar := []byte(fontsize + "\n") + foo = append(foo, bar...) + ioutil.WriteFile("/home/jcarr/.Xresources", foo, 0644) + + cmd := "xrdb -merge ~/.Xresources; cat ~/.Xresources" + xterm(cmd) + log.Println("button click end") + }) +}