add dev tools toggle to side menu

This commit is contained in:
2025-08-15 14:04:21 +12:00
parent 163d3c7b31
commit 47834020b2
4 changed files with 42 additions and 0 deletions
+14
View File
@@ -534,3 +534,17 @@ ipcMain.handle('get-about-info', () => {
return { error: err.message };
}
});
// Toggle DevTools for the requesting window (main window webContents)
ipcMain.handle('open-devtools', (event) => {
const wc = BrowserWindow.fromWebContents(event.sender);
if (!wc) return false;
const contents = wc.webContents;
if (contents.isDevToolsOpened()) {
contents.closeDevTools();
} else {
// Open docked inside the main window (bottom). Other options: 'right', 'undocked', 'detach'
contents.openDevTools({ mode: 'bottom' });
}
return contents.isDevToolsOpened();
});