fix: macos screen capture prompt

This commit is contained in:
2026-02-10 19:40:42 +01:00
parent d349b226aa
commit 84a9f6f8bd
6 changed files with 82 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ import {
ipcMain,
desktopCapturer,
session,
shell,
systemPreferences,
type IpcMainInvokeEvent,
type DesktopCapturerSource,
@@ -208,6 +209,20 @@ ipcMain.handle('helium:check-screen-permission', () => {
return 'granted';
});
ipcMain.handle('helium:open-screen-permission-settings', async () => {
if (!isMac) {
return false;
}
try {
await shell.openExternal('x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture');
return true;
} catch (error) {
console.error('[Helium] Failed to open macOS screen recording settings:', error);
return false;
}
});
const gotTheLock = app.requestSingleInstanceLock();
if (!gotTheLock) {

View File

@@ -57,6 +57,8 @@ const heliumElectronAPI = {
venmicUnlink: (): Promise<boolean> => ipcRenderer.invoke('helium:venmic-unlink'),
checkScreenPermission: (): Promise<string> => ipcRenderer.invoke('helium:check-screen-permission'),
openScreenPermissionSettings: (): Promise<boolean> =>
ipcRenderer.invoke('helium:open-screen-permission-settings'),
};
contextBridge.exposeInMainWorld('heliumElectron', heliumElectronAPI);