mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-06 22:12:12 +02:00
check accessibility permission before paste-back
This commit is contained in:
parent
2adffccd92
commit
bc16c0362d
1 changed files with 3 additions and 1 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import { BrowserWindow, clipboard, globalShortcut, ipcMain, screen, shell } from 'electron';
|
import { BrowserWindow, clipboard, globalShortcut, ipcMain, screen, shell, systemPreferences } from 'electron';
|
||||||
import { execSync } from 'child_process';
|
import { execSync } from 'child_process';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { IPC_CHANNELS } from '../ipc/channels';
|
import { IPC_CHANNELS } from '../ipc/channels';
|
||||||
|
|
@ -122,6 +122,8 @@ export function registerQuickAsk(): void {
|
||||||
ipcMain.handle(IPC_CHANNELS.REPLACE_TEXT, async (_event, text: string) => {
|
ipcMain.handle(IPC_CHANNELS.REPLACE_TEXT, async (_event, text: string) => {
|
||||||
if (process.platform !== 'darwin' || !sourceApp) return;
|
if (process.platform !== 'darwin' || !sourceApp) return;
|
||||||
|
|
||||||
|
if (!systemPreferences.isTrustedAccessibilityClient(true)) return;
|
||||||
|
|
||||||
clipboard.writeText(text);
|
clipboard.writeText(text);
|
||||||
hideQuickAsk();
|
hideQuickAsk();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue