Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Improve the window size settings after application restarts https://github.com/siyuan-note/siyuan/issues/13732

Daniel7ce19306ac23
diff --git a/app/electron/main.js b/app/electron/main.js
index 83b0d1831d..7d217a5097 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -277,7 +277,9 @@ const initMainWindow = () => {
let y = windowState.y;
if (workArea) {
// 窗口大于 workArea 时缩小会隐藏到左下角,这里使用最小值重置
- if (windowState.width > workArea.width || windowState.height > workArea.height) { // 重启后窗口大小恢复默认问题 https://github.com/siyuan-note/siyuan/issues/7755
+ if (windowState.width > workArea.width + 32 || windowState.height > workArea.height + 32) {
+ // 重启后窗口大小恢复默认问题 https://github.com/siyuan-note/siyuan/issues/7755 https://github.com/siyuan-note/siyuan/issues/13732
+ // 这里 +32 是因为在某种情况下窗口大小会比 workArea 大几个像素导致恢复默认,+32 可以避免这种特殊情况
windowState.width = Math.min(defaultWidth, workArea.width);
windowState.height = Math.min(defaultHeight, workArea.height);
}