Skip to content

Commit

Permalink
feat: zoom in/out and fullscreen shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
curiouslad committed Jan 14, 2025
1 parent 34848e8 commit 47ac729
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/libs/ShortcutRegister.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,21 @@ export class ShortcutRegister {
this._menuTemplate = args.menuTemplate || {};
this._mode = args.mode;
this.shortcuts = shortcutsStore.get('shortcuts', defaultShortcuts) as ShortcutRecord[];

globalShortcut.register('CommandOrControl+=', () => {
const currentZoom = this._mainWindow.webContents.getZoomLevel();
this._mainWindow.webContents.setZoomLevel(currentZoom + 1);
});
globalShortcut.register('CommandOrControl+-', () => {
const currentZoom = this._mainWindow.webContents.getZoomLevel();
this._mainWindow.webContents.setZoomLevel(currentZoom - 1);
});
globalShortcut.register('CommandOrControl+0', () => {
this._mainWindow.webContents.setZoomLevel(0);
});
globalShortcut.register('F11', () => {
this._mainWindow.setFullScreen(!this._mainWindow.isFullScreen());
});
}

public static getInstance (args?: { mainWindow?: BrowserWindow; menuTemplate?: OsMenu; mode?: ShortcutMode }) {
Expand Down

0 comments on commit 47ac729

Please sign in to comment.