Skip to content

TagSpaces is an offline, open source, document manager with tagging support

chore: add custom zoom factor for mac on electron

Ilian Sapundshiev71222e1e5420
diff --git a/src/main/main.ts b/src/main/main.ts
index bae69d008..f6ed9a136 100644
--- a/src/main/main.ts
+++ b/src/main/main.ts
@@ -487,6 +487,10 @@ const createWindow = async (i18n) => {
});*/
mainWindow.webContents.on('before-input-event', (_, input) => {
+ if (!mainWindow) {
+ throw new Error('"mainWindow" is not defined');
+ }
+
if (input.type === 'keyDown' && input.key === 'F12') {
mainWindow.webContents.isDevToolsOpened()
? mainWindow.webContents.closeDevTools()
@@ -507,6 +511,16 @@ const createWindow = async (i18n) => {
}
});
+ mainWindow.on('show', () => {
+ if (!mainWindow) {
+ throw new Error('"mainWindow" is not defined');
+ }
+
+ if (isMacLike) {
+ mainWindow.webContents.setZoomFactor(0.9);
+ }
+ });
+
mainWindow.on('closed', () => {
mainWindow = null;
});