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

This commit is contained in:
Daniel 2024-04-27 12:11:42 +08:00
parent 03a6c15d70
commit b64a9a3ad2
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
10 changed files with 75 additions and 17 deletions

View file

@ -230,7 +230,7 @@ const writeLog = (out) => {
}
};
const boot = () => {
const initMainWindow = () => {
let windowStateInitialized = true;
// 恢复主窗体状态
let oldWindowState = {};
@ -1019,7 +1019,7 @@ app.whenReady().then(() => {
if (!foundWorkspace) {
initKernel(data.workspace, "", "").then((isSucc) => {
if (isSucc) {
boot();
initMainWindow();
}
});
}
@ -1149,7 +1149,7 @@ app.whenReady().then(() => {
ipcMain.on("siyuan-first-init", (event, data) => {
initKernel(data.workspace, "", data.lang).then((isSucc) => {
if (isSucc) {
boot();
initMainWindow();
}
});
firstOpenWindow.destroy();
@ -1173,7 +1173,7 @@ app.whenReady().then(() => {
}
initKernel(workspace, port, "").then((isSucc) => {
if (isSucc) {
boot();
initMainWindow();
}
});
}
@ -1280,7 +1280,7 @@ app.on("second-instance", (event, argv) => {
if (workspace) {
initKernel(workspace, port, "").then((isSucc) => {
if (isSucc) {
boot();
initMainWindow();
}
});
return;
@ -1306,7 +1306,7 @@ app.on("activate", () => {
}
}
if (BrowserWindow.getAllWindows().length === 0) {
boot();
initMainWindow();
}
});