From 6adb29bc382c7c5bd1c51c22463590e0806f1ffd Mon Sep 17 00:00:00 2001 From: noctuum <25441068+noctuum@users.noreply.github.com> Date: Wed, 8 Apr 2026 04:56:05 +0700 Subject: [PATCH] fix(linux): remove unnecessary desktopCapturer call from display media handler The setDisplayMediaRequestHandler was calling desktopCapturer.getSources() to provide a video source that the renderer never uses (it requests video: false and only consumes audio tracks). On Wayland, this created a new xdg-desktop-portal ScreenCast session on every launch, showing an unavoidable screen share dialog because Electron does not persist PipeWire restore tokens across desktopCapturer sessions. Simplified the handler to return only { audio: 'loopback' }, which captures system audio via PipeWire/PulseAudio monitor source without any portal interaction. --- src/main/index.ts | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index 43e0eafc5..c5253edc0 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -5,7 +5,6 @@ import { app, BrowserWindow, BrowserWindowConstructorOptions, - desktopCapturer, globalShortcut, ipcMain, Menu, @@ -734,19 +733,7 @@ async function createWindow(first = true): Promise { }); mainWindow.webContents.session.setDisplayMediaRequestHandler((_request, callback) => { - desktopCapturer - .getSources({ types: ['screen'] }) - .then((sources) => { - if (sources.length > 0) { - callback({ audio: 'loopback', video: sources[0] }); - } else { - callback({}); - } - }) - .catch((err) => { - log.warn('desktopCapturer.getSources failed', err); - callback({}); - }); + callback({ audio: 'loopback' }); }); if (!disableAutoUpdates() && store.get('disable_auto_updates') !== true) {