Skip to content

Commit

Permalink
feat: Release devtools opening keyboard shortcut when goose window is…
Browse files Browse the repository at this point in the history
… not focused
  • Loading branch information
alexhancock committed Jan 15, 2025
1 parent 823fa36 commit dd8ff57
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions ui/desktop/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,31 @@ const createChat = async (app, query?: string, dir?: string, version?: string) =
);
}

// DevTools
globalShortcut.register('Alt+Command+I', () => {
mainWindow.webContents.openDevTools();
// DevTools shortcut management
const registerDevToolsShortcut = (window: BrowserWindow) => {
globalShortcut.register('Alt+Command+I', () => {
window.webContents.openDevTools();
});
};

const unregisterDevToolsShortcut = () => {
globalShortcut.unregister('Alt+Command+I');
};

// Register shortcut when window is focused
mainWindow.on('focus', () => {
registerDevToolsShortcut(mainWindow);
});

// Unregister shortcut when window loses focus
mainWindow.on('blur', () => {
unregisterDevToolsShortcut();
});

windowMap.set(windowId, mainWindow);
mainWindow.on('closed', () => {
windowMap.delete(windowId);
unregisterDevToolsShortcut();
});
};

Expand Down

0 comments on commit dd8ff57

Please sign in to comment.