[READ-ONLY] Mirror of https://github.com/probablykasper/ferrum. Music library app for Mac, Linux and Windows ferrum.kasper.space
electron linux macos music music-library music-player napi windows
0

Configure Feed

Select the types of activity you want to include in your feed.

Fix media keys shortcuts

Kasper (Apr 6, 2021, 3:50 AM +0200) e0d41abb d8f6bb4a

+4 -4
+4 -4
src/electron/shortcuts.js
··· 1 1 const { globalShortcut, dialog, systemPreferences } = require('electron') 2 2 const is = require('./is.js') 3 3 4 - function tryRegistering() { 4 + function tryRegistering(mainWindow) { 5 5 globalShortcut.register('MediaPlayPause', () => { 6 6 mainWindow.webContents.send('playPause') 7 7 }) ··· 39 39 if (is.mac) { 40 40 // prompt=true because of bug https://github.com/electron/electron/issues/20787 41 41 let trusted = systemPreferences.isTrustedAccessibilityClient(false) // prompt 42 - if (trusted) return tryRegistering() 42 + if (trusted) return tryRegistering(mainWindow) 43 43 const result = await dialog.showMessageBox({ 44 44 type: 'info', 45 45 message: 'Ferrum needs accessibility permissions to exclusively take over media keys', ··· 52 52 setTimeout(resolve, 2000) 53 53 }) 54 54 await requestRecursively('Click Done when you have granted Ferrum accessibility permissions.') 55 - tryRegistering() 55 + tryRegistering(mainWindow) 56 56 } 57 57 } else { 58 - return tryRegistering() 58 + return tryRegistering(mainWindow) 59 59 } 60 60 }