Create polished demo videos without editing skills. Mac/Windows/Linux
fix(linux): ignore invalid ozone overrides
wiiiii12376954785c6c5
diff --git a/electron/gpuSwitches.test.ts b/electron/gpuSwitches.test.tsindex a69b5318..4cbb1cdf 100644--- a/electron/gpuSwitches.test.ts+++ b/electron/gpuSwitches.test.ts@@ -21,6 +21,16 @@ describe("shouldForceLinuxEgl", () => {).toBe(false);});+ it("falls back to Electron's ozone hint when OZONE_PLATFORM is invalid", () => {+ expect(+ shouldForceLinuxEgl({+ OZONE_PLATFORM: "auto",+ ELECTRON_OZONE_PLATFORM_HINT: "wayland",+ XDG_SESSION_TYPE: "x11",+ }),+ ).toBe(false);+ });+it("forces EGL in an X11 session", () => {expect(shouldForceLinuxEgl({ XDG_SESSION_TYPE: "x11" })).toBe(true);});diff --git a/electron/gpuSwitches.ts b/electron/gpuSwitches.tsindex eada5a33..7b7c81ee 100644--- a/electron/gpuSwitches.ts+++ b/electron/gpuSwitches.ts@@ -4,19 +4,22 @@ export interface GpuSwitches {disableFeatures?: string[];}-function getForcedLinuxWindowSystem(env: NodeJS.ProcessEnv): "wayland" | "x11" | null {- const ozonePlatform =- env.OZONE_PLATFORM?.toLowerCase() ??- env.ELECTRON_OZONE_PLATFORM_HINT?.toLowerCase() ??- null;-- if (ozonePlatform === "wayland" || ozonePlatform === "x11") {- return ozonePlatform;+function normalizeLinuxWindowSystem(value: string | undefined): "wayland" | "x11" | null {+ const normalized = value?.trim().toLowerCase();+ if (normalized === "wayland" || normalized === "x11") {+ return normalized;}return null;}+function getForcedLinuxWindowSystem(env: NodeJS.ProcessEnv): "wayland" | "x11" | null {+ return (+ normalizeLinuxWindowSystem(env.OZONE_PLATFORM) ??+ normalizeLinuxWindowSystem(env.ELECTRON_OZONE_PLATFORM_HINT)+ );+}+export function shouldForceLinuxEgl(env: NodeJS.ProcessEnv): boolean {const forcedWindowSystem = getForcedLinuxWindowSystem(env);if (forcedWindowSystem === "wayland") {