diff --git a/build/entitlements.mac.plist b/build/entitlements.mac.plist index 46f67566..0d041c2c 100644 --- a/build/entitlements.mac.plist +++ b/build/entitlements.mac.plist @@ -8,5 +8,7 @@ com.apple.security.cs.disable-library-validation + com.apple.security.device.audio-input + diff --git a/electron/main.ts b/electron/main.ts index e4fb5ffd..75bc93c4 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, shell } from 'electron'; +import { app, BrowserWindow, session, shell } from 'electron'; import path from 'path'; import fs from 'fs'; import { fileURLToPath } from 'url'; @@ -138,7 +138,23 @@ function createWindow() { }); } -app.whenReady().then(createWindow); +app.whenReady().then(() => { + // Grant microphone and clipboard access (deny camera/video) + session.defaultSession.setPermissionRequestHandler( + (_webContents, permission, callback, details) => { + if (permission === 'clipboard-read') { + return callback(true); + } + if (permission === 'media') { + const types = (details as { mediaTypes?: string[] }).mediaTypes ?? []; + return callback(types.every((t) => t === 'audio')); + } + callback(false); + }, + ); + + createWindow(); +}); app.on('before-quit', () => { killAllAgents(); diff --git a/package.json b/package.json index c3ba8c9d..0593bd24 100644 --- a/package.json +++ b/package.json @@ -113,6 +113,9 @@ "target": "dmg", "category": "public.app-category.developer-tools", "hardenedRuntime": true, + "extendInfo": { + "NSMicrophoneUsageDescription": "Parallel Code needs microphone access for voice input in terminal sessions." + }, "gatekeeperAssess": false, "notarize": true, "x64ArchFiles": "Contents/Resources/app.asar.unpacked/node_modules/node-pty/prebuilds/**",