wit-debian-gui/window-xterm-fontsize.go

53 lines
1.2 KiB
Go

package main
import "log"
// import "strconv"
import "io/ioutil"
import "git.wit.org/wit/gui"
func xtermSettings(w *gui.Node) {
if (w == nil) {
gui.Config.Title = "xterm font setting"
gui.Config.Width = 105
gui.Config.Height = 105
gui.Config.Exit = customExit
w = gui.NewWindow()
}
tab := w.AddTab("xtermSettings()", nil)
// populateNEW(tab, "new")
////////////// filename /////////////////////////
gNode := tab.AddGroup("filename")
fontsize := "16"
resolvNode := gNode.AddComboBox("8",
"16",
"24")
resolvNode.SetText("12")
resolvNode.OnChanged = func () {
log.Println("STARTED HOSTNAME")
fontsize = resolvNode.GetText()
log.Println("ENDED GetText() HOSTNAME =", fontsize)
}
////////////// connect /////////////////////////
gNode = tab.AddGroup("Update")
gNode.AddButton("setup .Xresources", func (*gui.Node) {
log.Println("fontsize =", fontsize)
// write out .Xresources file
foo := []byte("xterm*faceName: Monospace\nxterm*faceSize: ")
// bar := []byte(strconv.Itoa(fontsize) + "\n")
bar := []byte(fontsize + "\n")
foo = append(foo, bar...)
ioutil.WriteFile("/home/jcarr/.Xresources", foo, 0644)
cmd := "xrdb -merge ~/.Xresources; cat ~/.Xresources"
xterm(cmd)
log.Println("button click end")
})
}