85 lines
1.9 KiB
Go
85 lines
1.9 KiB
Go
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)
|
|
}
|