Skip to content

Commit 73d68c9

Browse files
feat(stage-tamagotchi): wayland support (#761)
1 parent a33667a commit 73d68c9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

apps/stage-tamagotchi/src/main/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { BrowserWindow } from 'electron'
22

33
import type { WidgetsWindowManager } from './windows/widgets'
44

5-
import { platform } from 'node:process'
5+
import { env, platform } from 'node:process'
66

77
import { electronApp, optimizer } from '@electron-toolkit/utils'
88
import { Format, LogLevel, setGlobalFormat, setGlobalLogLevel, useLogg } from '@guiiai/logg'
@@ -51,6 +51,18 @@ if (isLinux) {
5151
app.commandLine.appendSwitch('enable-features', 'SharedArrayBuffer')
5252
app.commandLine.appendSwitch('enable-unsafe-webgpu')
5353
app.commandLine.appendSwitch('enable-features', 'Vulkan')
54+
55+
// NOTICE: we need UseOzonePlatform, WaylandWindowDecorations for working on Wayland.
56+
// Partially related to https://github.com/electron/electron/issues/41551, since X11 is deprecating now,
57+
// we can safely remove the feature flags for Electron once they made it default supported.
58+
// Fixes: https://github.com/moeru-ai/airi/issues/757
59+
// Ref: https://github.com/mmaura/poe2linuxcompanion/blob/90664607a147ea5ccea28df6139bd95fb0ebab0e/electron/main/index.ts#L28-L46
60+
if (env.XDG_SESSION_TYPE === 'wayland') {
61+
app.commandLine.appendSwitch('enable-features', 'GlobalShortcutsPortal')
62+
63+
app.commandLine.appendSwitch('enable-features', 'UseOzonePlatform')
64+
app.commandLine.appendSwitch('enable-features', 'WaylandWindowDecorations')
65+
}
5466
}
5567

5668
app.dock?.setIcon(icon)

0 commit comments

Comments
 (0)