feat(stage-tamagotchi): wayland support (#761)

This commit is contained in:
Astro Angelfish
2025-11-24 17:20:35 +08:00
committed by GitHub
parent a33667a48f
commit 73d68c91be
+13 -1
View File
@@ -2,7 +2,7 @@ import type { BrowserWindow } from 'electron'
import type { WidgetsWindowManager } from './windows/widgets'
import { platform } from 'node:process'
import { env, platform } from 'node:process'
import { electronApp, optimizer } from '@electron-toolkit/utils'
import { Format, LogLevel, setGlobalFormat, setGlobalLogLevel, useLogg } from '@guiiai/logg'
@@ -51,6 +51,18 @@ if (isLinux) {
app.commandLine.appendSwitch('enable-features', 'SharedArrayBuffer')
app.commandLine.appendSwitch('enable-unsafe-webgpu')
app.commandLine.appendSwitch('enable-features', 'Vulkan')
// NOTICE: we need UseOzonePlatform, WaylandWindowDecorations for working on Wayland.
// Partially related to https://github.com/electron/electron/issues/41551, since X11 is deprecating now,
// we can safely remove the feature flags for Electron once they made it default supported.
// Fixes: https://github.com/moeru-ai/airi/issues/757
// Ref: https://github.com/mmaura/poe2linuxcompanion/blob/90664607a147ea5ccea28df6139bd95fb0ebab0e/electron/main/index.ts#L28-L46
if (env.XDG_SESSION_TYPE === 'wayland') {
app.commandLine.appendSwitch('enable-features', 'GlobalShortcutsPortal')
app.commandLine.appendSwitch('enable-features', 'UseOzonePlatform')
app.commandLine.appendSwitch('enable-features', 'WaylandWindowDecorations')
}
}
app.dock?.setIcon(icon)