🎨 桌面端重启以后保证窗口最小大小 Fix https://github.com/siyuan-note/siyuan/issues/6041

This commit is contained in:
Liang Ding 2022-10-01 22:52:45 +08:00
parent 149ad91383
commit c50679ec9e
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -84,10 +84,8 @@ try {
} }
} catch (e) { } catch (e) {
console.error(e) console.error(e)
require('electron'). require('electron').dialog.showErrorBox('创建配置目录失败 Failed to create config directory',
dialog. '思源需要在用户家目录下创建配置文件夹(~/.config/siyuan请确保该路径具有写入权限。\n\nSiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.')
showErrorBox('创建配置目录失败 Failed to create config directory',
'思源需要在用户家目录下创建配置文件夹(~/.config/siyuan请确保该路径具有写入权限。\n\nSiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.')
app.exit() app.exit()
} }
@ -151,12 +149,6 @@ const boot = () => {
windowState.width = Math.min(defaultWidth, workArea.width) windowState.width = Math.min(defaultWidth, workArea.width)
windowState.height = Math.min(defaultHeight, workArea.height) windowState.height = Math.min(defaultHeight, workArea.height)
} }
if (windowState.width < 256) {
windowState.width = Math.min(defaultWidth, workArea.width)
}
if (windowState.height < 256) {
windowState.height = Math.min(defaultHeight, workArea.height)
}
if (x > workArea.width || x < 0) { if (x > workArea.width || x < 0) {
x = 0 x = 0
} }
@ -164,6 +156,12 @@ const boot = () => {
y = 0 y = 0
} }
} }
if (windowState.width < 400) {
windowState.width = 400
}
if (windowState.height < 300) {
windowState.height = 300
}
// 创建主窗体 // 创建主窗体
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({