🎨 Support minimize the main window after auto launch on Windows https://github.com/siyuan-note/siyuan/issues/11145

This commit is contained in:
Daniel 2024-04-28 12:29:32 +08:00
parent b6cae8cf8e
commit b6eff31ba8
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -382,8 +382,8 @@ const initMainWindow = () => {
// 主界面事件监听
currentWindow.once("ready-to-show", () => {
if (workspaces.length === 0 && openAsHidden) {
bootWindow.minimize();
if (1 === workspaces.length && openAsHidden) {
currentWindow.minimize();
} else {
currentWindow.show();
if (windowState.isMaximized) {
@ -444,6 +444,7 @@ const showWindow = (wnd) => {
const initKernel = (workspace, port, lang) => {
return new Promise(async (resolve) => {
bootWindow = new BrowserWindow({
show: false,
width: Math.floor(screen.getPrimaryDisplay().size.width / 2),
height: Math.floor(screen.getPrimaryDisplay().workAreaSize.height / 2),
frame: false,
@ -640,6 +641,7 @@ for (let i = argStart; i < process.argv.length; i++) {
// 跳过内置参数
if (arg.startsWith("--openAsHidden")) {
openAsHidden = true;
writeLog("open as hidden");
}
continue;
}