From 73d68c91be3ffac8a3f46e6f6e5843d260f571d6 Mon Sep 17 00:00:00 2001 From: Astro Angelfish Date: Mon, 24 Nov 2025 17:20:35 +0800 Subject: [PATCH] feat(stage-tamagotchi): wayland support (#761) --- apps/stage-tamagotchi/src/main/index.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/stage-tamagotchi/src/main/index.ts b/apps/stage-tamagotchi/src/main/index.ts index c2ed8eb0e..6453fbc73 100644 --- a/apps/stage-tamagotchi/src/main/index.ts +++ b/apps/stage-tamagotchi/src/main/index.ts @@ -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)