2021-11-02 23:44:28 -05:00
|
|
|
package main
|
|
|
|
|
2024-01-05 12:13:21 -06:00
|
|
|
import (
|
2024-01-24 18:24:38 -06:00
|
|
|
"go.wit.com/gui"
|
|
|
|
"go.wit.com/lib/gadgets"
|
2024-01-05 12:13:21 -06:00
|
|
|
"go.wit.com/log"
|
|
|
|
)
|
2021-11-02 23:44:28 -05:00
|
|
|
|
2024-01-05 12:13:21 -06:00
|
|
|
var webWin *gadgets.BasicWindow
|
2021-11-02 23:44:28 -05:00
|
|
|
|
2024-01-05 12:13:21 -06:00
|
|
|
func windowAddWWW() {
|
2024-01-24 18:24:38 -06:00
|
|
|
if webWin != nil {
|
2024-01-05 12:13:21 -06:00
|
|
|
webWin.Toggle()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
webWin = gadgets.NewBasicWindow(myGui, "webpages")
|
2021-11-02 23:44:28 -05:00
|
|
|
|
2024-01-24 18:24:38 -06:00
|
|
|
////////////// connect /////////////////////////
|
2024-01-05 12:13:21 -06:00
|
|
|
gNode := webWin.Box().NewGroup("www")
|
2024-01-24 18:24:38 -06:00
|
|
|
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/")
|
2021-11-02 23:44:28 -05:00
|
|
|
}
|
|
|
|
|
2024-01-24 18:24:38 -06:00
|
|
|
func firefoxButton(n *gui.Node, name string, url string) {
|
|
|
|
n.NewButton(name, func() {
|
2021-11-02 23:44:28 -05:00
|
|
|
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()
|
|
|
|
}
|