Remove global shortcuts when player isn't active
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
module.exports = {
|
||||
init
|
||||
init,
|
||||
registerPlayerShortcuts,
|
||||
unregisterPlayerShortcuts
|
||||
}
|
||||
|
||||
var electron = require('electron')
|
||||
@@ -11,11 +13,17 @@ var menu = require('./menu')
|
||||
var windows = require('./windows')
|
||||
|
||||
function init () {
|
||||
// Special "media key" for play/pause, available on some keyboards
|
||||
globalShortcut.register('MediaPlayPause', () => windows.main.send('dispatch', 'playPause'))
|
||||
|
||||
// ⌘+Shift+F is an alternative fullscreen shortcut to the ones defined in menu.js.
|
||||
// Electron does not support multiple accelerators for a single menu item, so this
|
||||
// is registered separately here.
|
||||
localShortcut.register('CmdOrCtrl+Shift+F', menu.toggleFullScreen)
|
||||
}
|
||||
|
||||
function registerPlayerShortcuts () {
|
||||
// Special "media key" for play/pause, available on some keyboards
|
||||
globalShortcut.register('MediaPlayPause', () => windows.main.send('dispatch', 'playPause'))
|
||||
}
|
||||
|
||||
function unregisterPlayerShortcuts () {
|
||||
globalShortcut.unregister('MediaPlayPause')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user