package main import ( "os/user" "go.wit.com/gui" "go.wit.com/lib/gadgets" "go.wit.com/log" ) var userNode *gui.Node var sshWin *gadgets.BasicWindow func sshGenericWindow() { if sshWin != nil { sshWin.Toggle() return } sshWin = gadgets.NewBasicWindow(myGui, "sshWindow") ////////////// username ///////////////////////// gNode := sshWin.Box().NewGroup("username") userNode = gNode.NewCombobox("username") userNode.AddText("root") userNode.AddText("jcarr") userNode.AddText("hugo") userNode.Custom = func() { username = userNode.GetText() log.Println("SETTING: username=", username) userNode.Dump() // panic("blah") } tmp, _ := user.Current() username = tmp.Username userNode.SetText(username) userNode.Dump() // panic("blah") ////////////// hostname ///////////////////////// gNode = sshWin.Box().NewGroup("homename") hostNode := gNode.NewCombobox("hostname") hostNode.AddText("www") hostNode.AddText("mirrors") hostNode.AddText("git") hostNode.Custom = func() { log.Println("STARTED HOSTNAME") hostname = hostNode.GetText() log.Println("ENDED GetText() HOSTNAME") } hostname = "mirrors" hostNode.SetText("mirrors") ////////////// connect ///////////////////////// gNode = sshWin.Box().NewGroup("connect") gNode.NewButton("connect", func() { cmd := "ssh -v " + username + "@" + hostname log.Println("xterm cmd=", cmd) xterm(cmd) }) }