wit-debian-gui/window-ssh-generic.go

66 lines
1.4 KiB
Go
Raw Permalink Normal View History

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