piss/cmd/piss/main.go

38 lines
816 B
Go

package main
import "os/exec"
import "git.tebibyte.media/sashakoshka/tomo"
import "git.tebibyte.media/sashakoshka/tomo/popups"
// import "git.tebibyte.media/sashakoshka/tomo/elements"
import pissElements "git.tebibyte.media/sashakoshka/piss/elements"
import _ "git.tebibyte.media/sashakoshka/tomo/backends/all"
func main () {
tomo.Run(run)
}
func run () {
window, _ := tomo.NewWindow(480, 360)
window.SetTitle("Terminal")
terminal := pissElements.NewTerminal()
window.Adopt(terminal)
window.OnClose(tomo.Stop)
window.Show()
shell := "ls"
command := exec.Command(shell)
err := terminal.Start(command)
if err != nil {
popups.NewDialog (
popups.DialogKindError,
window,
"Couldn't start shell",
"Could not start " + command.String() + ":\n" +
err.Error(),
).OnClose(tomo.Stop)
}
}