wit-debian-gui/window-www.go

38 lines
952 B
Go

package main
import (
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/log"
)
var webWin *gadgets.BasicWindow
func windowAddWWW() {
if webWin != nil {
webWin.Toggle()
return
}
webWin = gadgets.NewBasicWindow(myGui, "webpages")
////////////// connect /////////////////////////
gNode := webWin.Box().NewGroup("www")
firefoxButton(gNode, "git", "https://git.wit.org/")
firefoxButton(gNode, "mirrors", "https://mirrors.wit.org/")
firefoxButton(gNode, "IPv6-Only ping", "http://ping.wit.org/")
firefoxButton(gNode, "SyncThing", "http://localhost:8384/")
firefoxButton(gNode, "pprof this GO app", "http://localhost:6060/debug/pprof/")
}
func firefoxButton(n *gui.Node, name string, url string) {
n.NewButton(name, func() {
log.Println("button clicked: trying to open url")
var tmp []string
tmp = append(tmp, "nohup")
tmp = append(tmp, firefox...)
tmp = append(tmp, url)
go runCommand(tmp)
})
// bNode.Dump()
}