Open DevTools and focus the Element Inspector tool.
macOS: CmdShiftC
Linux: CtrlShiftC
Windows: CtrlShiftC
Known limitations
The shortcuts only work while the app window has focus. Electron does not deliver keyboard input to the DevTools web contents, so there is no way to detect the shortcut while DevTools itself has focus. Click the app window first, then use the shortcut.
Install
npm install electron-debug
Requires Electron 44 or later.
Usage
import {app, BrowserWindow} from 'electron';import debug from 'electron-debug';debug();let mainWindow;(async () => { await app.whenReady(); mainWindow = new BrowserWindow();})();
API
Only runs when in development, unless overridden by the isEnabled option. So no need to guard it for production.
debug(options?)
Install keyboard shortcuts and optionally activate DevTools on each BrowserWindow, including the ones that already exist when this is called.