`globalShortcut` will register the shortcut at the OS level, even when the app is not focused. Using `localShortcut` would work, but let's put it in the top menu instead, where all the other shortcuts are.
22 lines
692 B
JavaScript
22 lines
692 B
JavaScript
module.exports = {
|
|
init
|
|
}
|
|
|
|
var electron = require('electron')
|
|
var localShortcut = require('electron-localshortcut')
|
|
|
|
var globalShortcut = electron.globalShortcut
|
|
|
|
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)
|
|
}
|