From c8d4e867b23452a8f184a5b3a7be3a1b2b7851a3 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Sat, 2 May 2026 17:53:43 -0700 Subject: [PATCH] fix recording inception error --- electron/ipc/handlers.ts | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts index 95ed797..e067f59 100644 --- a/electron/ipc/handlers.ts +++ b/electron/ipc/handlers.ts @@ -526,14 +526,27 @@ export function registerIpcHandlers( }); ipcMain.handle("get-sources", async (_, opts) => { + const ownWindowSourceIds = new Set( + BrowserWindow.getAllWindows() + .map((win) => { + try { + return win.getMediaSourceId(); + } catch { + return null; + } + }) + .filter((id): id is string => Boolean(id)), + ); const sources = await desktopCapturer.getSources(opts); - return sources.map((source) => ({ - id: source.id, - name: source.name, - display_id: source.display_id, - thumbnail: source.thumbnail ? source.thumbnail.toDataURL() : null, - appIcon: source.appIcon ? source.appIcon.toDataURL() : null, - })); + return sources + .filter((source) => !ownWindowSourceIds.has(source.id)) + .map((source) => ({ + id: source.id, + name: source.name, + display_id: source.display_id, + thumbnail: source.thumbnail ? source.thumbnail.toDataURL() : null, + appIcon: source.appIcon ? source.appIcon.toDataURL() : null, + })); }); ipcMain.handle("select-source", (_, source: SelectedSource) => {