itd/cmd/itgui/main.go

36 lines
744 B
Go
Raw Permalink Normal View History

2021-08-26 04:18:24 +00:00
package main
import (
2021-08-27 15:47:24 +00:00
"net"
2021-08-26 04:18:24 +00:00
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
)
var SockPath = "/tmp/itd/socket"
func main() {
2021-08-26 15:47:17 +00:00
// Create new app
2021-08-26 04:18:24 +00:00
a := app.New()
2021-08-26 15:47:17 +00:00
// Create new window with title "itgui"
2021-08-26 04:18:24 +00:00
window := a.NewWindow("itgui")
2021-08-27 15:47:24 +00:00
_, err := net.Dial("unix", SockPath)
if err != nil {
guiErr(err, "Error dialing itd socket", true, window)
}
2021-08-26 15:47:17 +00:00
// Create new app tabs container
2021-08-26 04:18:24 +00:00
tabs := container.NewAppTabs(
container.NewTabItem("Info", infoTab(window)),
container.NewTabItem("Notify", notifyTab(window)),
container.NewTabItem("Set Time", timeTab(window)),
container.NewTabItem("Upgrade", upgradeTab(window)),
)
2021-08-26 15:47:17 +00:00
// Set tabs as window content
2021-08-26 04:18:24 +00:00
window.SetContent(tabs)
2021-08-26 15:47:17 +00:00
// Show window and run app
2021-08-26 04:18:24 +00:00
window.ShowAndRun()
}