Files
plotzilla/main.go
T
Kharec 6622203506 fix: create the file passed on the command line when it is missing
A path that did not exist was silently ignored: plotzilla
new-script.fountain opened an untitled document instead of a new
script saved to that file on the first save.
2026-10-15 17:57:24 +02:00

62 lines
1.6 KiB
Go

package main
import (
"embed"
"log"
"os"
"strings"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/options"
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
"github.com/wailsapp/wails/v2/pkg/options/linux"
)
//go:embed all:frontend/dist
var assets embed.FS
// icon is the window icon on X11; Wayland compositors take it from the
// installed .desktop file instead (desktop/plotzilla.desktop).
//
//go:embed desktop/plotzilla.png
var icon []byte
func main() {
// The UI is in English: make GTK's own strings (file chooser buttons and
// places) match it instead of following the system language.
os.Setenv("LANGUAGE", "en")
app := NewApp()
for _, arg := range os.Args[1:] {
if !strings.HasPrefix(arg, "-") {
app.initialPath = arg // may not exist yet: then it is a new script
break
}
}
err := wails.Run(&options.App{
Title: "Plotzilla",
Width: 1320,
Height: 920,
MinWidth: 900,
MinHeight: 600,
AssetServer: &assetserver.Options{Assets: assets},
// The header bar is drawn by the page, like a GNOME header bar; the
// transparent background lets the page round the window corners.
Frameless: true,
BackgroundColour: &options.RGBA{R: 0, G: 0, B: 0, A: 0},
OnStartup: app.startup,
OnBeforeClose: app.beforeClose,
Bind: []interface{}{app},
Linux: &linux.Options{
ProgramName: "plotzilla",
Icon: icon,
WindowIsTranslucent: true,
WebviewGpuPolicy: linux.WebviewGpuPolicyOnDemand,
},
})
if err != nil {
log.Fatal(err)
}
}