Skip to content

Commit f38e683

Browse files
authored
fix: scaling issue (#185)
1 parent 2f93e33 commit f38e683

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

main.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,29 @@ function createWindow() {
5555
sandbox: false,
5656
},
5757
// Use a frameless window so we can render a custom SnapDock titlebar
58-
frame: false,
58+
frame: false, // need to set to if dev == true else false
5959
// On macOS we can hint to hide the native title bar inset
6060
titleBarStyle: process.platform === 'darwin' ? 'hiddenInset' : undefined,
6161
});
6262

63+
// --- DPI SCALING FIX ---
64+
const { screen } = require("electron");
65+
const scaleFactor = screen.getPrimaryDisplay().scaleFactor;
66+
67+
let zoom = 1.0;
68+
if (scaleFactor >= 1.25 && scaleFactor < 1.5) zoom = 1.10;
69+
else if (scaleFactor >= 1.5 && scaleFactor < 2.0) zoom = 1.25;
70+
else if (scaleFactor >= 2.0) zoom = 1.40;
71+
72+
mainWindow.webContents.setZoomFactor(zoom);
73+
// ------------------------
74+
6375
// Remove all menus
6476
mainWindow.setMenu(null);
6577
mainWindow.setMenuBarVisibility(false);
6678
mainWindow.setAutoHideMenuBar(true);
6779

80+
// need to unblock for dev builds or test builds
6881
// Block DevTools shortcuts
6982
mainWindow.webContents.on("before-input-event", (event, input) => {
7083
if (

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "snapdock",
3-
"version": "3.1.2",
3+
"version": "3.1.3",
44
"description": "A Minimal, Modern Markdown Editor",
55
"synopsis": "Fast, clean Markdown editor",
66
"homepage": "https://snapdock.app",

0 commit comments

Comments
 (0)