[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 Next/Previous/Stop media keys

Kasper (Jan 6, 2023, 10:31 AM +0100) 090f7f0e 0b35b0a4

+11 -4
+3
CHANGELOG.md
··· 1 1 # Changelog 2 2 3 + ## Next 4 + - Fix Next/Previous/Stop media key shortcuts 5 + 3 6 ## 0.16.3 - 2022 Nov 7 4 7 - Improve focus behavior 5 8
+6 -4
src/electron/shortcuts.ts
··· 1 1 import { globalShortcut, dialog, systemPreferences, BrowserWindow } from 'electron' 2 2 import is from './is' 3 + import type { WebContents } from './typed_ipc' 3 4 4 5 function tryRegistering(mainWindow: BrowserWindow) { 6 + const webContents = mainWindow.webContents as WebContents 5 7 const success1 = globalShortcut.register('MediaPlayPause', () => { 6 - if (mainWindow !== null) mainWindow.webContents.send('playPause') 8 + if (mainWindow !== null) webContents.send('playPause') 7 9 }) 8 10 if (!success1) return false 9 11 globalShortcut.register('MediaNextTrack', () => { 10 - if (mainWindow !== null) mainWindow.webContents.send('next') 12 + if (mainWindow !== null) webContents.send('Next') 11 13 }) 12 14 globalShortcut.register('MediaPreviousTrack', () => { 13 - if (mainWindow !== null) mainWindow.webContents.send('previous') 15 + if (mainWindow !== null) webContents.send('Previous') 14 16 }) 15 17 globalShortcut.register('MediaStop', () => { 16 - if (mainWindow !== null) mainWindow.webContents.send('stop') 18 + if (mainWindow !== null) webContents.send('Stop') 17 19 }) 18 20 return true 19 21 }
+1
src/electron/typed_ipc.ts
··· 100 100 playPause: () => void 101 101 Next: () => void 102 102 Previous: () => void 103 + Stop: () => void 103 104 Shuffle: () => void 104 105 Repeat: () => void 105 106 volumeUp: () => void
+1
src/lib/player.ts
··· 274 274 ipcRenderer.on('playPause', playPause) 275 275 ipcRenderer.on('Next', next) 276 276 ipcRenderer.on('Previous', previous) 277 + ipcRenderer.on('Stop', stop)