mirror of
https://github.com/antebudimir/feishin.git
synced 2025-12-31 10:03:33 +00:00
[bugfix]: Macos trusted accessibility (#512)
* [bugfix]: macos trusted accessibility * update readme
This commit is contained in:
parent
1e5d446ced
commit
ce9c03b0e1
2 changed files with 24 additions and 1 deletions
|
|
@ -1,7 +1,26 @@
|
|||
/* eslint-disable promise/always-return */
|
||||
import { BrowserWindow, globalShortcut } from 'electron';
|
||||
import { BrowserWindow, globalShortcut, systemPreferences } from 'electron';
|
||||
import { isMacOS } from '../../../utils';
|
||||
import { store } from '../settings';
|
||||
|
||||
export const enableMediaKeys = (window: BrowserWindow | null) => {
|
||||
if (isMacOS()) {
|
||||
const shouldPrompt = store.get('should_prompt_accessibility', true) as boolean;
|
||||
const trusted = systemPreferences.isTrustedAccessibilityClient(shouldPrompt);
|
||||
|
||||
if (shouldPrompt) {
|
||||
store.set('should_prompt_accessibility', false);
|
||||
}
|
||||
|
||||
if (!trusted) {
|
||||
window?.webContents.send('toast-from-main', {
|
||||
message:
|
||||
'Feishin is not a trusted accessibility client. Media keys will not work until this setting is changed',
|
||||
type: 'warning',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
globalShortcut.register('MediaStop', () => {
|
||||
window?.webContents.send('renderer-player-stop');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue