From 1c199a0366ebee57120b8919886383777517ccc4 Mon Sep 17 00:00:00 2001 From: Gauravjeet Singh Date: Thu, 18 Jul 2024 19:09:23 -0400 Subject: [PATCH] fix: add a keyboard shortcut for devtools --- app.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index c8726014..bdb8c278 100644 --- a/app.js +++ b/app.js @@ -63,7 +63,7 @@ i18n.init({ expressApp.use(express.static(path.join(__dirname, 'www', 'obs'))); -const { app, webContents, BrowserWindow, dialog, ipcMain, safeStorage } = electron; +const { app, webContents, BrowserWindow, dialog, ipcMain, safeStorage, globalShortcut } = electron; const store = new Store({ configName: 'user-preferences', @@ -300,7 +300,7 @@ function checkForExternalDisplay() { viewerWindowPos.y = externalDisplay.bounds.y + 50; viewerWindowPos.w = externalDisplay.size.width; viewerWindowPos.h = externalDisplay.size.height; - return true; + return false; } return false; } @@ -637,6 +637,12 @@ app.on('ready', () => { createViewer(); } }); + + globalShortcut.register('CommandOrControl+Shift+I', () => { + if (mainWindow) { + mainWindow.webContents.openDevTools(); + } + }); }); // Quit when all windows are closed.