@@ -34,6 +34,9 @@ import * as ElectronMenu from "../../electron/ElectronMenu.ts";
3434import * as ElectronShell from "../../electron/ElectronShell.ts" ;
3535import * as ElectronTheme from "../../electron/ElectronTheme.ts" ;
3636import * as ElectronWindow from "../../electron/ElectronWindow.ts" ;
37+ import * as Electron from "electron" ;
38+ import * as MacPermissions from "../../permissions/MacPermissions.ts" ;
39+ import { safariPermissionCheck } from "../../preview/BrowserImport/SafariPermission.ts" ;
3740import * as IpcChannels from "../channels.ts" ;
3841import * as DesktopIpc from "../DesktopIpc.ts" ;
3942import {
@@ -305,7 +308,16 @@ export const openSystemSettings = DesktopIpc.makeIpcMethod({
305308 result : Schema . Boolean ,
306309 handler : Effect . fn ( "desktop.ipc.window.openSystemSettings" ) ( function * ( pane ) {
307310 const shell = yield * ElectronShell . ElectronShell ;
308- return yield * shell . openSystemSettings ( pane ) ;
311+ const environment = yield * DesktopEnvironment . DesktopEnvironment ;
312+ if ( environment . platform !== "darwin" ) return false ;
313+ const owner = Electron . BrowserWindow . getFocusedWindow ( ) ;
314+ const opened = yield * shell . openSystemSettings ( pane ) ;
315+ if ( opened && environment . isPackaged ) {
316+ const permissions = yield * MacPermissions . MacPermissions ;
317+ const isGranted = yield * safariPermissionCheck ;
318+ yield * permissions . showHelper ( pane , owner , isGranted ) ;
319+ }
320+ return opened ;
309321 } ) ,
310322} ) ;
311323
@@ -379,3 +391,15 @@ export const pickThemeFiles = DesktopIpc.makeIpcMethod({
379391 } ) ;
380392 } ) ,
381393} ) ;
394+
395+ export const checkSystemPermission = DesktopIpc . makeIpcMethod ( {
396+ channel : IpcChannels . CHECK_SYSTEM_PERMISSION_CHANNEL ,
397+ payload : SystemSettingsPaneSchema ,
398+ result : Schema . Boolean ,
399+ handler : Effect . fn ( "desktop.ipc.window.checkSystemPermission" ) ( function * ( ) {
400+ const environment = yield * DesktopEnvironment . DesktopEnvironment ;
401+ if ( environment . platform !== "darwin" ) return false ;
402+ const check = yield * safariPermissionCheck ;
403+ return yield * Effect . promise ( check ) ;
404+ } ) ,
405+ } ) ;
0 commit comments