feat: add global shortcut for zooming in the Electron app

This commit is contained in:
Sanjai Kumar 2024-11-14 13:58:41 +05:30
parent 40001949b8
commit 48b0c1b731

View File

@ -11,7 +11,7 @@ if (isDev) {
}
const { format } = require('url');
const { BrowserWindow, app, Menu, ipcMain } = require('electron');
const { BrowserWindow, app, Menu, ipcMain, globalShortcut } = require('electron');
const { setContentSecurityPolicy } = require('electron-util');
const menuTemplate = require('./app/menu-template');
@ -141,6 +141,11 @@ app.on('ready', async () => {
}
return { action: 'deny' };
});
// Quick fix for Electron issue #29996: https://github.com/electron/electron/issues/29996
globalShortcut.register('Ctrl+=', () => {
mainWindow.webContents.setZoomLevel(mainWindow.webContents.getZoomLevel() + 1);
});
// register all ipc handlers
registerNetworkIpc(mainWindow);