From daa34a7caad3ec6ff451ef5ceb65ed312192074a Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 16 Apr 2019 18:23:22 +0200 Subject: [PATCH] MOBILE-2986 desktop: Add shortcut to open dev tools --- desktop/electron.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/desktop/electron.js b/desktop/electron.js index 343f81a5b..5e10f57b7 100644 --- a/desktop/electron.js +++ b/desktop/electron.js @@ -68,6 +68,14 @@ function createWindow() { // Append some text to the user agent. mainWindow.webContents.setUserAgent(mainWindow.webContents.getUserAgent() + ' ' + userAgent); + + // Add shortcut to open dev tools: Control/Cmd + Alt + I. + mainWindow.webContents.on('before-input-event', function(e, input) { + // The "meta" key is Cmd in MacOS and Control in Windows/Linux. + if (input.type == 'keyDown' && !input.isAutoRepeat && input.code == 'KeyI' && input.alt && input.meta) { + mainWindow.webContents.toggleDevTools(); + } + }, true) } // Make sure that only a single instance of the app is running. @@ -221,22 +229,18 @@ function setAppMenu() { submenu: [ { label: 'Cut', - accelerator: 'CmdOrCtrl+X', role: 'cut' }, { label: 'Copy', - accelerator: 'CmdOrCtrl+C', role: 'copy' }, { label: 'Paste', - accelerator: 'CmdOrCtrl+V', role: 'paste' }, { label: 'Select All', - accelerator: 'CmdOrCtrl+A', role: 'selectall' } ]