ADD: Debug menu + DevTools shortcut

This commit is contained in:
Robert Kossessa
2024-02-09 21:14:50 +01:00
parent f2f263040a
commit 722a76f212
3 changed files with 20 additions and 1 deletions

View File

@@ -147,6 +147,7 @@ app.whenReady().then(() => {
})
ipcMain.on('electron:closeWindow', () => mainWindow.close())
ipcMain.on('electron:openExternal', (_event, url) => shell.openExternal(url))
ipcMain.on('electron:openDevTools', () => mainWindow.webContents.openDevTools())
nanodevices.onAttach((device) => {
console.log('Attached device', device)
mainWindow.webContents.send('nanodevice-attached', device)
@@ -174,9 +175,21 @@ app.whenReady().then(() => {
}),
}))
}
if (isDevelopment) {
menu.append(new MenuItem({
label: 'Debug',
submenu: [
{
label: 'Open DevTools',
accelerator: 'CmdOrCtrl+Shift+I',
click: () => mainWindow.webContents.openDevTools(),
},
],
}))
}
Menu.setApplicationMenu(menu)
mainWindow.webContents.openDevTools()
//mainWindow.webContents.openDevTools()
})
// Quit when all windows are closed, except on macOS. There, it's common