fix: window may flash when startup

This commit is contained in:
tiny-craft 2023-10-31 11:45:55 +08:00
parent 694214bedf
commit 929c4d2794
1 changed files with 5 additions and 0 deletions

View File

@ -10,6 +10,7 @@ import (
"github.com/wailsapp/wails/v2/pkg/options/linux" "github.com/wailsapp/wails/v2/pkg/options/linux"
"github.com/wailsapp/wails/v2/pkg/options/mac" "github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2/pkg/options/windows" "github.com/wailsapp/wails/v2/pkg/options/windows"
runtime2 "github.com/wailsapp/wails/v2/pkg/runtime"
"runtime" "runtime"
"tinyrdm/backend/consts" "tinyrdm/backend/consts"
"tinyrdm/backend/services" "tinyrdm/backend/services"
@ -54,6 +55,7 @@ func main() {
Assets: assets, Assets: assets,
}, },
BackgroundColour: options.NewRGBA(27, 38, 54, 0), BackgroundColour: options.NewRGBA(27, 38, 54, 0),
StartHidden: true,
OnStartup: func(ctx context.Context) { OnStartup: func(ctx context.Context) {
sysSvc.Start(ctx) sysSvc.Start(ctx)
connSvc.Start(ctx) connSvc.Start(ctx)
@ -62,6 +64,9 @@ func main() {
services.GA().SetSecretKey(gaMeasurementID, gaSecretKey) services.GA().SetSecretKey(gaMeasurementID, gaSecretKey)
services.GA().Startup(version) services.GA().Startup(version)
}, },
OnDomReady: func(ctx context.Context) {
runtime2.WindowShow(ctx)
},
OnShutdown: func(ctx context.Context) { OnShutdown: func(ctx context.Context) {
connSvc.Stop() connSvc.Stop()
cliSvc.CloseAll() cliSvc.CloseAll()