mirror of
https://github.com/SrIzan10/helium.git
synced 2026-06-06 00:56:58 +00:00
fix: macos screen capture prompt
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user