In main/index.js
,
import { globalShortcut } from 'electron'
// mainWindow is an instance of BrowserWindow
let mainWindow;
app.on('ready', () => {
globalShortcut.on('CommandOrControl+,', () => {
mainWindow.webContents.send('shortcut-settings')
})
})
In renderer/main.js
,
import { ipcRenderer } from 'electron'
ipcRenderer.on('shortcut-settings', () => {
// do whatever...
// maybe, you're using vue, if so tell the router to go to the settings page.
router.replace('/settings')
})