Skip to content

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

:art: https://github.com/siyuan-note/siyuan/issues/12656

Vanessa72240c7f384f
diff --git a/app/electron/main.js b/app/electron/main.js
index 6f627a8e28..999e78aa1d 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -43,7 +43,7 @@ const windowStatePath = path.join(confDir, "windowState.json");
let bootWindow;
let latestActiveWindow;
let firstOpen = false;
-let workspaces = []; // workspaceDir, id, browserWindow, tray
+let workspaces = []; // workspaceDir, id, browserWindow, tray, hideShortcut
let kernelPort = 6806;
let resetWindowStateOnRestart = false;
@@ -1098,6 +1098,12 @@ app.whenReady().then(() => {
if (!data.hotkeys || data.hotkeys.length === 0) {
return;
}
+ workspaces.find(workspaceItem => {
+ if (event.sender.id === workspaceItem.browserWindow.webContents.id) {
+ workspaceItem.hotkeys = data.hotkeys;
+ return true;
+ }
+ });
data.hotkeys.forEach((item, index) => {
const shortcut = hotKey2Electron(item);
if (!shortcut) {
@@ -1111,11 +1117,19 @@ app.whenReady().then(() => {
let currentWorkspace;
const currentWebContentsId = (latestActiveWindow && !latestActiveWindow.isDestroyed()) ? latestActiveWindow.webContents.id : undefined;
workspaces.find(workspaceItem => {
- if ((currentWebContentsId || event.sender.id) === workspaceItem.browserWindow.webContents.id) {
+ if (currentWebContentsId === workspaceItem.browserWindow.webContents.id && workspaceItem.hotkeys[0] === item) {
currentWorkspace = workspaceItem;
return true;
}
});
+ if (!currentWorkspace) {
+ workspaces.find(workspaceItem => {
+ if (workspaceItem.hotkeys[0] === item && event.sender.id === workspaceItem.browserWindow.webContents.id) {
+ currentWorkspace = workspaceItem;
+ return true;
+ }
+ });
+ }
if (!currentWorkspace) {
return;
}