Files
webtorrent-desktop/main/shortcuts.js
Feross Aboukhadijeh 2005ee4d0b shortcuts.js: Consistent exported method naming
Exposed methods whose sole purpose is notify the module of an event
firing, should start with "on".
2016-05-12 16:52:13 -07:00

32 lines
856 B
JavaScript

module.exports = {
init,
onPlayerClose,
onPlayerOpen
}
var electron = require('electron')
var localShortcut = require('electron-localshortcut')
var globalShortcut = electron.globalShortcut
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.
localShortcut.register('CmdOrCtrl+Shift+F', menu.toggleFullScreen)
}
function onPlayerOpen () {
// Register special "media key" for play/pause, available on some keyboards
globalShortcut.register('MediaPlayPause', function () {
windows.main.send('dispatch', 'playPause')
})
}
function onPlayerClose () {
globalShortcut.unregister('MediaPlayPause')
}