Skip to content

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

:art: 通过 `Alt+M` 最小化后焦点回到先前的窗口 Fix https://github.com/siyuan-note/siyuan/issues/7275

Liang Ding5bd6bb8925ff
diff --git a/app/electron/main.js b/app/electron/main.js
index d30bc34461..eaf4b5b73a 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -635,6 +635,12 @@ app.whenReady().then(() => {
tray.setContextMenu(contextMenu)
}
+ const hideWindow = (wnd) => {
+ // 通过 `Alt+M` 最小化后焦点回到先前的窗口 https://github.com/siyuan-note/siyuan/issues/7275
+ wnd.minimize()
+ wnd.hide()
+ }
+
const showHideWindow = (tray, lang, mainWindow) => {
if (!mainWindow.isVisible()) {
if (mainWindow.isMinimized()) {
@@ -642,7 +648,7 @@ app.whenReady().then(() => {
}
mainWindow.show()
} else {
- mainWindow.hide()
+ hideWindow(mainWindow)
}
resetTrayMenu(tray, lang, mainWindow)
@@ -657,7 +663,7 @@ app.whenReady().then(() => {
ipcMain.on('siyuan-config-tray', (event, data) => {
workspaces.find(item => {
if (item.id === data.id) {
- item.browserWindow.hide()
+ hideWindow(item.browserWindow)
if ('win32' === process.platform || 'linux' === process.platform) {
resetTrayMenu(item.tray, data.languages, item.browserWindow)
}
@@ -814,10 +820,10 @@ app.whenReady().then(() => {
if (!mainWindow.isFocused()) {
mainWindow.show()
} else {
- mainWindow.hide()
+ hideWindow(mainWindow)
}
} else {
- mainWindow.hide()
+ hideWindow(mainWindow)
}
} else {
mainWindow.show()