Merge pull request #117 from feross/media-key
Register "media key" for play/pause
This commit is contained in:
@@ -16,7 +16,7 @@ app.on('open-url', onOpen)
|
||||
app.on('ready', function () {
|
||||
electron.Menu.setApplicationMenu(menu.appMenu)
|
||||
windows.createMainWindow(menu)
|
||||
shortcuts.init(menu)
|
||||
shortcuts.init(menu, windows)
|
||||
})
|
||||
|
||||
app.on('activate', function () {
|
||||
|
||||
@@ -2,11 +2,16 @@ module.exports = {
|
||||
init: init
|
||||
}
|
||||
|
||||
var electron = require('electron')
|
||||
var globalShortcut = electron.globalShortcut
|
||||
var localShortcut = require('electron-localshortcut')
|
||||
|
||||
function init (menu) {
|
||||
function init (menu, windows) {
|
||||
// ⌘+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)
|
||||
|
||||
// Special "media key" for play/pause, available on some keyboards
|
||||
globalShortcut.register('MediaPlayPause', () => windows.main.send('dispatch', 'playPause'))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user