Skip to content

Commit a722804

Browse files
committed
fix: persist window height across restarts
1 parent 4f4b1f7 commit a722804

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/main/main.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ function createWindow() {
232232
mainWindow = new BrowserWindow({
233233
width: Math.round(590 / screen.getPrimaryDisplay().scaleFactor),
234234
maxWidth: Math.round(590 / screen.getPrimaryDisplay().scaleFactor),
235-
height: Math.round(720 / screen.getPrimaryDisplay().scaleFactor),
235+
height: Math.round((store.get('app.windowHeight', 720)) / screen.getPrimaryDisplay().scaleFactor),
236236
minHeight: Math.round(500 / screen.getPrimaryDisplay().scaleFactor),
237237
resizable: true,
238238
frame: false,
@@ -256,6 +256,12 @@ function createWindow() {
256256
}
257257
});
258258

259+
mainWindow.on('resize', () => {
260+
const [, height] = mainWindow.getSize();
261+
const physicalHeight = Math.round(height * screen.getPrimaryDisplay().scaleFactor);
262+
store.set('app.windowHeight', physicalHeight);
263+
});
264+
259265
mainWindow.on('close', (e) => {
260266
if (!app.isQuitting) {
261267
e.preventDefault();

0 commit comments

Comments
 (0)