From f4e9d79c7ed007aba96b5ee4ed991362aa89cfe1 Mon Sep 17 00:00:00 2001 From: pannet1 <12350276+pannet1@users.noreply.github.com> Date: Sun, 20 Sep 2026 01:29:16 +0530 Subject: [PATCH] fix(linux): resolve X11 screen capture and WebGL preview issues - Stop forcing EGL on X11 to prevent GPU process crash and enable WebGL/WebGPU - Ensure Wayland screen portal is only used on Wayland sessions, fixing X11 desktop capture Fixes #1001 --- electron/gpuSwitches.test.ts | 2 +- electron/gpuSwitches.ts | 3 ++- electron/main.ts | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/electron/gpuSwitches.test.ts b/electron/gpuSwitches.test.ts index 4cbb1cdf4..334f22b2d 100644 --- a/electron/gpuSwitches.test.ts +++ b/electron/gpuSwitches.test.ts @@ -60,7 +60,7 @@ describe("getGpuSwitches", () => { it("returns the X11 EGL workaround on Linux X11", () => { expect(getGpuSwitches("linux", { XDG_SESSION_TYPE: "x11" })).toEqual({ - useGl: "egl", + useGl: undefined, disableFeatures: ["VaapiVideoDecoder", "VaapiVideoEncoder"], }); }); diff --git a/electron/gpuSwitches.ts b/electron/gpuSwitches.ts index 7b7c81ee8..4c14709dc 100644 --- a/electron/gpuSwitches.ts +++ b/electron/gpuSwitches.ts @@ -44,6 +44,7 @@ export function getGpuSwitches( platform: NodeJS.Platform, env: NodeJS.ProcessEnv = process.env, ): GpuSwitches { + void env; if (platform === "darwin") { return { useAngle: "metal", @@ -57,7 +58,7 @@ export function getGpuSwitches( if (platform === "linux") { return { - useGl: shouldForceLinuxEgl(env) ? "egl" : undefined, + useGl: undefined, disableFeatures: ["VaapiVideoDecoder", "VaapiVideoEncoder"], }; } diff --git a/electron/main.ts b/electron/main.ts index 890726670..351f1e56d 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -18,6 +18,7 @@ import { import { RECORDINGS_DIR } from "./appPaths"; import { showCursor } from "./cursorHider"; import { getGpuSwitches } from "./gpuSwitches"; +import { isLikelyLinuxWaylandSession } from "./ipc/register/sourceMapping"; import { cleanupAllExportStreams, cleanupNativeVideoExportSessions, @@ -1101,7 +1102,9 @@ app.whenReady().then(async () => { // source picker entirely). This avoids calling getSources() which // would itself trigger an extra portal dialog. const isLinuxPortalSentinel = - process.platform === "linux" && (sourceId === "screen:linux-portal" || !sourceId); + process.platform === "linux" && + isLikelyLinuxWaylandSession(process.env) && + (sourceId === "screen:linux-portal" || !sourceId); if (isLinuxPortalSentinel) { callback({ video: { id: "screen:0:0", name: "Entire screen" } }); return;