[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
|
@ -49,8 +49,12 @@ Rewrite of [Sonixd](https://github.com/jeffvli/sonixd).
|
||||||
|
|
||||||
Download the [latest desktop client](https://github.com/jeffvli/feishin/releases). The desktop client is the recommended way to use Feishin. It supports both the MPV and web player backends, as well as includes built-in fetching for lyrics.
|
Download the [latest desktop client](https://github.com/jeffvli/feishin/releases). The desktop client is the recommended way to use Feishin. It supports both the MPV and web player backends, as well as includes built-in fetching for lyrics.
|
||||||
|
|
||||||
|
#### MacOS Notes
|
||||||
|
|
||||||
If you're using a device running macOS 12 (Monterey) or higher, [check here](https://github.com/jeffvli/feishin/issues/104#issuecomment-1553914730) for instructions on how to remove the app from quarantine.
|
If you're using a device running macOS 12 (Monterey) or higher, [check here](https://github.com/jeffvli/feishin/issues/104#issuecomment-1553914730) for instructions on how to remove the app from quarantine.
|
||||||
|
|
||||||
|
For media keys to work, you will be prompted to allow Feishin to be a Trusted Accessibility Client. After allowing, you will need to restart Feishin for the privacy settings to take effect.
|
||||||
|
|
||||||
### Web and Docker
|
### Web and Docker
|
||||||
|
|
||||||
Visit [https://feishin.vercel.app](https://feishin.vercel.app) to use the hosted web version of Feishin. The web client only supports the web player backend.
|
Visit [https://feishin.vercel.app](https://feishin.vercel.app) to use the hosted web version of Feishin. The web client only supports the web player backend.
|
||||||
|
|
|
@ -1,7 +1,26 @@
|
||||||
/* eslint-disable promise/always-return */
|
/* 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) => {
|
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', () => {
|
globalShortcut.register('MediaStop', () => {
|
||||||
window?.webContents.send('renderer-player-stop');
|
window?.webContents.send('renderer-player-stop');
|
||||||
});
|
});
|
||||||
|
|
Reference in a new issue