From d9955547cd75b2d78c478950cd35c6f9375ca608 Mon Sep 17 00:00:00 2001 From: Arjun <6592213+arkml@users.noreply.github.com> Date: Sun, 29 Mar 2026 00:01:50 +0530 Subject: [PATCH] native popup --- apps/x/apps/main/src/ipc.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/x/apps/main/src/ipc.ts b/apps/x/apps/main/src/ipc.ts index 2ab77c1e..0fa0de79 100644 --- a/apps/x/apps/main/src/ipc.ts +++ b/apps/x/apps/main/src/ipc.ts @@ -1,4 +1,4 @@ -import { ipcMain, BrowserWindow, shell, dialog, systemPreferences } from 'electron'; +import { ipcMain, BrowserWindow, shell, dialog, systemPreferences, desktopCapturer } from 'electron'; import { ipc } from '@x/shared'; import path from 'node:path'; import os from 'node:os'; @@ -723,7 +723,15 @@ export function setupIpcHandlers() { if (process.platform !== 'darwin') return { granted: true }; const status = systemPreferences.getMediaAccessStatus('screen'); console.log('[meeting] Screen recording permission status:', status); - return { granted: status === 'granted' }; + if (status === 'granted') return { granted: true }; + // Not granted — call desktopCapturer.getSources() to register the app + // in the macOS Screen Recording list. On first call this shows the + // native permission prompt (signed apps are remembered across restarts). + try { await desktopCapturer.getSources({ types: ['screen'] }); } catch { /* ignore */ } + // Re-check after the native prompt was dismissed + const statusAfter = systemPreferences.getMediaAccessStatus('screen'); + console.log('[meeting] Screen recording permission status after prompt:', statusAfter); + return { granted: statusAfter === 'granted' }; }, 'meeting:openScreenRecordingSettings': async () => { await shell.openExternal('x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture');