WebKitGTK 6.0 removed WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND, so Wails maps OnDemand to ALWAYS. Never (the old Nvidia/X11 blank-window workaround) forces CPU raster on the GTK4/WebKit 6 stack. All target machines are AMD or Intel, where the Nvidia DMABUF workaround is unnecessary, so let the GPU handle scrolling/compositing.
63 lines
1.8 KiB
Go
63 lines
1.8 KiB
Go
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)
|
|
}
|
|
}
|