mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-06 09:47:44 +02:00
[eric] win: toggle devtools on f12 + ctrl/cmd+shift+i since the windows menu bar is hidden
This commit is contained in:
@@ -1249,6 +1249,19 @@ function createWindow() {
|
||||
console.log(`[renderer:${tag}] ${message}${src ? ` (${src}:${line})` : ''}`);
|
||||
});
|
||||
|
||||
// DevTools shortcut. Windows/Linux hide the menu bar, so the default View >
|
||||
// Toggle Developer Tools route is unreachable there (Mac keeps its menu);
|
||||
// wire F12 and Ctrl/Cmd+Shift+I directly so support can grab logs anywhere.
|
||||
mainWindow.webContents.on('before-input-event', (event, input) => {
|
||||
if (input.type !== 'keyDown') return;
|
||||
const key = (input.key || '').toLowerCase();
|
||||
const isInspect = (input.control || input.meta) && input.shift && key === 'i';
|
||||
if (key === 'f12' || isInspect) {
|
||||
mainWindow.webContents.toggleDevTools();
|
||||
event.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
isCreatingMainWindow = false;
|
||||
console.log('[diag][main] createWindow end, ua=', mainWindow.webContents.getUserAgent());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user