package main import ( "embed" "log" "github.com/wailsapp/wails/v3/pkg/application" ) //go:embed all:frontend/dist var assets embed.FS func main() { // The service is created after the application (it needs the app // reference), so the single-instance callback closes over the variable // and resolves it at call time. A second instance can only launch once // this one is running, by which point svc is always set. var svc *App // Create application with options app := application.New(application.Options{ Name: "AniTrack", Description: "Track anime watchlists across AniList, MyAnimeList, and Simkl", Assets: application.AssetOptions{ Handler: application.AssetFileServerFS(assets), }, SingleInstance: &application.SingleInstanceOptions{ UniqueID: "49c93b6d-663d-4b7a-9cb0-8a469ea9182b", OnSecondInstanceLaunch: func(data application.SecondInstanceData) { svc.onSecondInstanceLaunch(data) }, }, Linux: application.LinuxOptions{ ProgramName: "AniTrack", }, }) svc = NewApp(app) app.RegisterService(application.NewService(svc)) app.Window.NewWithOptions(application.WebviewWindowOptions{ Title: appTitle(), Width: 1024, Height: 768, BackgroundColour: application.NewRGBA(27, 38, 54, 1), URL: "/", Linux: application.LinuxWindow{ Icon: []byte("./build/AniTrack.png"), WindowIsTranslucent: false, // OnDemand: GPU for scrolling/compositing on AMD/Intel Mesa, // software fallback otherwise. Never (the old Nvidia/X11 // blank-window workaround) forces CPU raster on GTK4/WebKit 6 // and makes scrolling janky. All target machines here are // AMD or Intel, so the Nvidia DMABUF workaround is not needed. WebviewGpuPolicy: application.WebviewGpuPolicyOnDemand, }, }) if err := app.Run(); err != nil { log.Fatal(err) } }