This commit is contained in:
2026-07-15 22:52:53 -05:00
parent ba16f5fe06
commit a60d03a3a7
3 changed files with 211 additions and 40 deletions

27
main.ts
View File

@@ -765,4 +765,29 @@ try {
);
}
win.show();
win.show();
// Workaround: with the experimental desktop backend the first BrowserWindow
// "adopts" the implicit startup window, which is created before user code
// runs. Sometimes the native window keeps its built-in default size even
// though getSize() already reports the requested values, so the early
// setSize-on-mismatch above is skipped. Enforce the persisted size
// unconditionally after show(), and verify once more shortly after.
try {
win.setSize(clamped.windowWidth, clamped.windowHeight);
setTimeout(() => {
try {
const [w, h] = win.getSize();
if (w !== clamped.windowWidth || h !== clamped.windowHeight) {
console.log(
`${PREFIX} Window size drifted to ${w}x${h}, enforcing ${clamped.windowWidth}x${clamped.windowHeight}`,
);
win.setSize(clamped.windowWidth, clamped.windowHeight);
}
} catch { /* ok */ }
}, 250);
} catch (err) {
console.warn(
`${PREFIX} Post-show size enforcement failed: ${errorMessage(err)}`,
);
}