fix: dev-tools work again

This commit is contained in:
2026-02-11 09:19:16 +01:00
parent 4da195c89a
commit e66c64350f

View File

@@ -37,6 +37,7 @@ function createWindow(): void {
nodeIntegration: false, nodeIntegration: false,
contextIsolation: true, contextIsolation: true,
sandbox: false, sandbox: false,
devTools: true,
}, },
icon: path.join(__dirname, '../../assets/icon.png'), icon: path.join(__dirname, '../../assets/icon.png'),
}); });
@@ -45,6 +46,16 @@ function createWindow(): void {
const menu = createApplicationMenu(); const menu = createApplicationMenu();
Menu.setApplicationMenu(menu); Menu.setApplicationMenu(menu);
// Register keyboard shortcuts for DevTools via before-input-event (more reliable)
mainWindow.webContents.on('before-input-event', (event, input) => {
// F12 or Ctrl+Shift+I to toggle DevTools
if (input.key === 'F12' ||
(input.control && input.shift && input.key.toLowerCase() === 'i')) {
mainWindow?.webContents.toggleDevTools();
event.preventDefault();
}
});
// Load the app - use built files unless explicitly in dev mode // Load the app - use built files unless explicitly in dev mode
const rendererPath = path.join(__dirname, '../renderer/index.html'); const rendererPath = path.join(__dirname, '../renderer/index.html');
if (isDev) { if (isDev) {
@@ -186,7 +197,13 @@ function createApplicationMenu(): Menu {
{ type: 'separator' }, { type: 'separator' },
{ role: 'reload' }, { role: 'reload' },
{ role: 'forceReload' }, { role: 'forceReload' },
{ role: 'toggleDevTools' }, {
label: 'Toggle Developer Tools',
accelerator: process.platform === 'darwin' ? 'Cmd+Option+I' : 'Ctrl+Shift+I',
click: () => {
mainWindow?.webContents.toggleDevTools();
},
},
{ type: 'separator' }, { type: 'separator' },
{ role: 'resetZoom' }, { role: 'resetZoom' },
{ role: 'zoomIn' }, { role: 'zoomIn' },