Playback menu: Add "Play/Pause" item

The goal here is to remove shortcut handling from the renderer and
unify it all in menu.js and shortcuts.ks (for alternate shortcuts).

I would rather name it "Play" and change to "Pause" when video is
playing, but Electron doesn't support this (yet).
This commit is contained in:
Feross Aboukhadijeh
2016-05-11 20:18:27 +02:00
parent 3d6da99e8e
commit 1deab08d38
3 changed files with 42 additions and 22 deletions

View File

@@ -13,17 +13,17 @@ var menu = require('./menu')
var windows = require('./windows')
function init () {
// ⌘+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.
// Register alternate shortcuts here. Most shortcuts are registered in menu,js, but Electron does not support multiple shortcuts for a single menu item.
localShortcut.register('CmdOrCtrl+Shift+F', menu.toggleFullScreen)
localShortcut.register('Space', () => windows.main.send('dispatch', 'playPause'))
}
function onPlayerOpen () {
// Register special "media key" for play/pause, available on some keyboards
globalShortcut.register('MediaPlayPause', function () {
windows.main.send('dispatch', 'playPause')
})
globalShortcut.register(
'MediaPlayPause',
() => windows.main.send('dispatch', 'playPause')
)
}
function onPlayerClose () {