pref: remove transparent background on Windows

This commit is contained in:
Lykin 2024-08-07 23:12:01 +08:00
parent a14e7e947e
commit c54567115e
1 changed files with 12 additions and 8 deletions

20
main.go
View File

@ -3,6 +3,7 @@ package main
import ( import (
"context" "context"
"embed" "embed"
"fmt"
"github.com/wailsapp/wails/v2" "github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/menu" "github.com/wailsapp/wails/v2/pkg/menu"
"github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options"
@ -25,6 +26,8 @@ var icon []byte
var version = "0.0.0" var version = "0.0.0"
var gaMeasurementID, gaSecretKey string var gaMeasurementID, gaSecretKey string
const appName = "Tiny RDM"
func main() { func main() {
// Create an instance of the app structure // Create an instance of the app structure
sysSvc := services.System() sysSvc := services.System()
@ -43,8 +46,9 @@ func main() {
} }
// menu // menu
isMacOS := runtime.GOOS == "darwin"
appMenu := menu.NewMenu() appMenu := menu.NewMenu()
if runtime.GOOS == "darwin" { if isMacOS {
appMenu.Append(menu.AppMenu()) appMenu.Append(menu.AppMenu())
appMenu.Append(menu.EditMenu()) appMenu.Append(menu.EditMenu())
appMenu.Append(menu.WindowMenu()) appMenu.Append(menu.WindowMenu())
@ -52,19 +56,19 @@ func main() {
// Create application with options // Create application with options
err := wails.Run(&options.App{ err := wails.Run(&options.App{
Title: "Tiny RDM", Title: appName,
Width: windowWidth, Width: windowWidth,
Height: windowHeight, Height: windowHeight,
MinWidth: consts.MIN_WINDOW_WIDTH, MinWidth: consts.MIN_WINDOW_WIDTH,
MinHeight: consts.MIN_WINDOW_HEIGHT, MinHeight: consts.MIN_WINDOW_HEIGHT,
WindowStartState: windowStartState, WindowStartState: windowStartState,
Frameless: runtime.GOOS != "darwin", Frameless: !isMacOS,
Menu: appMenu, Menu: appMenu,
EnableDefaultContextMenu: true, EnableDefaultContextMenu: true,
AssetServer: &assetserver.Options{ AssetServer: &assetserver.Options{
Assets: assets, Assets: assets,
}, },
BackgroundColour: options.NewRGBA(27, 38, 54, 0), BackgroundColour: options.NewRGBA(255, 255, 255, 0),
StartHidden: true, StartHidden: true,
OnStartup: func(ctx context.Context) { OnStartup: func(ctx context.Context) {
sysSvc.Start(ctx, version) sysSvc.Start(ctx, version)
@ -105,7 +109,7 @@ func main() {
Mac: &mac.Options{ Mac: &mac.Options{
TitleBar: mac.TitleBarHiddenInset(), TitleBar: mac.TitleBarHiddenInset(),
About: &mac.AboutInfo{ About: &mac.AboutInfo{
Title: "Tiny RDM " + version, Title: fmt.Sprintf("%s %s", appName, version),
Message: "A modern lightweight cross-platform Redis desktop client.\n\nCopyright © 2024", Message: "A modern lightweight cross-platform Redis desktop client.\n\nCopyright © 2024",
Icon: icon, Icon: icon,
}, },
@ -113,12 +117,12 @@ func main() {
WindowIsTranslucent: false, WindowIsTranslucent: false,
}, },
Windows: &windows.Options{ Windows: &windows.Options{
WebviewIsTransparent: true, WebviewIsTransparent: false,
WindowIsTranslucent: true, WindowIsTranslucent: false,
DisableFramelessWindowDecorations: false, DisableFramelessWindowDecorations: false,
}, },
Linux: &linux.Options{ Linux: &linux.Options{
ProgramName: "Tiny RDM", ProgramName: appName,
Icon: icon, Icon: icon,
WebviewGpuPolicy: linux.WebviewGpuPolicyOnDemand, WebviewGpuPolicy: linux.WebviewGpuPolicyOnDemand,
WindowIsTranslucent: true, WindowIsTranslucent: true,