mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Improve the main window size after restarts https://github.com/siyuan-note/siyuan/issues/13732
This commit is contained in:
parent
3bedd9f042
commit
7da5040bac
1 changed files with 6 additions and 2 deletions
|
|
@ -248,6 +248,7 @@ const initMainWindow = () => {
|
||||||
try {
|
try {
|
||||||
oldWindowState = JSON.parse(fs.readFileSync(windowStatePath, "utf8"));
|
oldWindowState = JSON.parse(fs.readFileSync(windowStatePath, "utf8"));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
writeLog("read window state failed: " + e);
|
||||||
fs.writeFileSync(windowStatePath, "{}");
|
fs.writeFileSync(windowStatePath, "{}");
|
||||||
}
|
}
|
||||||
let defaultWidth;
|
let defaultWidth;
|
||||||
|
|
@ -258,7 +259,7 @@ const initMainWindow = () => {
|
||||||
defaultHeight = Math.floor(screen.getPrimaryDisplay().workAreaSize.height * 0.8);
|
defaultHeight = Math.floor(screen.getPrimaryDisplay().workAreaSize.height * 0.8);
|
||||||
workArea = screen.getPrimaryDisplay().workArea;
|
workArea = screen.getPrimaryDisplay().workArea;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
writeLog("get screen size failed: " + e);
|
||||||
}
|
}
|
||||||
const windowState = Object.assign({}, {
|
const windowState = Object.assign({}, {
|
||||||
isMaximized: false,
|
isMaximized: false,
|
||||||
|
|
@ -270,7 +271,10 @@ const initMainWindow = () => {
|
||||||
height: defaultHeight,
|
height: defaultHeight,
|
||||||
}, oldWindowState);
|
}, oldWindowState);
|
||||||
|
|
||||||
writeLog("window size [x=" + windowState.x + ", y=" + windowState.y + ", width=" + windowState.width + ", height=" + windowState.height + "], default [width=" + defaultWidth + ", height=" + defaultHeight + "], workArea [width=" + workArea.width + ", height=" + workArea.height + "]");
|
writeLog("window stat [x=" + windowState.x + ", y=" + windowState.y + ", width=" + windowState.width + ", height=" + windowState.height + "], " +
|
||||||
|
"default [x=0, y=0, width=" + defaultWidth + ", height=" + defaultHeight + "], " +
|
||||||
|
"old [x=" + oldWindowState.x + ", y=" + oldWindowState.y + ", width=" + oldWindowState.width + ", height=" + oldWindowState.height + "], " +
|
||||||
|
"workArea [width=" + workArea.width + ", height=" + workArea.height + "]");
|
||||||
|
|
||||||
let resetToCenter = false;
|
let resetToCenter = false;
|
||||||
let x = windowState.x;
|
let x = windowState.x;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue