From 43b01cfb604d5f0832db9903d542e44bcf1107c8 Mon Sep 17 00:00:00 2001 From: Siddharth Date: Wed, 3 Jun 2026 19:41:25 -0700 Subject: [PATCH] record permissions prompt --- electron/ipc/handlers.ts | 32 +++++++++++++++++++++++++++++++- src/hooks/useScreenRecorder.ts | 4 +++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/electron/ipc/handlers.ts b/electron/ipc/handlers.ts index f2812d4f..a7f41016 100644 --- a/electron/ipc/handlers.ts +++ b/electron/ipc/handlers.ts @@ -1396,7 +1396,37 @@ export function registerIpcHandlers( }); ipcMain.handle("request-native-mac-cursor-access", async () => { - return requestMacCursorAccessibilityAccess(); + const access = await requestMacCursorAccessibilityAccess(); + + // When the editable cursor can't get Accessibility trust, don't leave the + // user guessing where to enable it — pop a native dialog that deep-links + // straight to the Accessibility pane (mirrors the Screen Recording flow). + if (process.platform === "darwin" && !access.granted) { + const mainWin = getMainWindow(); + const detail = + access.status === "missing-helper" + ? "The cursor helper couldn't be found in this build, so the editable cursor can't be enabled. Rebuild the native helper (npm run build:native:mac) or switch the HUD cursor mode to system." + : "Allow OpenScreen under System Settings → Privacy & Security → Accessibility, then press record again to start the countdown."; + const messageOptions = { + type: "warning", + buttons: ["Open Accessibility Settings", "Cancel"], + defaultId: 0, + cancelId: 1, + message: "Accessibility access is required for the editable cursor", + detail, + } satisfies Electron.MessageBoxOptions; + const result = + mainWin && !mainWin.isDestroyed() + ? await dialog.showMessageBox(mainWin, messageOptions) + : await dialog.showMessageBox(messageOptions); + if (result.response === 0) { + await shell.openExternal( + "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility", + ); + } + } + + return access; }); ipcMain.handle("open-source-selector", async () => { diff --git a/src/hooks/useScreenRecorder.ts b/src/hooks/useScreenRecorder.ts index f5fb9203..e0db20ed 100644 --- a/src/hooks/useScreenRecorder.ts +++ b/src/hooks/useScreenRecorder.ts @@ -1069,9 +1069,11 @@ export function useScreenRecorder(): UseScreenRecorderReturn { try { const platform = await window.electronAPI.getPlatform(); if (platform === "darwin" && cursorCaptureMode === "editable-overlay") { + // The main process shows a native dialog that deep-links to the + // Accessibility settings pane when access is missing, so we just stop + // here and let the user grant it and press record again. const access = await window.electronAPI.requestNativeMacCursorAccess(); if (!access.granted) { - toast.info(t("recording.accessibilityAllowAndRetry")); return; } }