Skip to content

Commit

Permalink
feat: add global shortcut for toggling devTools
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Mar 28, 2023
1 parent 49a0dd3 commit 1934318
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Most properties of the `config.json`-file are also automatically updated when mo
## Keyboard shortcuts

- `CTRL+Alt+SHIFT+F` Toggles fullscreen for the current (or last) selected window
- `CTRL+Alt+SHIFT+I` Toggles DevTools (console) for the current (or last) selected window
- `CTRL+Alt+SHIFT+C` Opens the config file in the system default editor

## Configuration
Expand Down
3 changes: 3 additions & 0 deletions src/helpers/AllWindowsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export class AllWindowsManager extends EventEmitter {
globalShortcut.register('CommandOrControl+Alt+Shift+F', () => {
this.lastFocusedWindow?.toggleFullScreen()
})
globalShortcut.register('CommandOrControl+Alt+Shift+I', () => {
this.lastFocusedWindow?.toggleDevTools()
})
}

public getWindow(id: string): WindowHelper | undefined {
Expand Down
3 changes: 3 additions & 0 deletions src/helpers/WindowHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,9 @@ export class WindowHelper extends EventEmitter {
this.window.setFullScreen(!this.window.isFullScreen())
this.updateSizeAndPosition()
}
public toggleDevTools(): void {
this.window.webContents.toggleDevTools()
}
/** Play the specified URL in the window */
async playURL(url: string | null): Promise<void> {
if (this.url !== url) {
Expand Down

0 comments on commit 1934318

Please sign in to comment.