An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/17599
Vanessa30c0572702b1
diff --git a/app/electron/main.js b/app/electron/main.jsindex bea584bbe8..306b6948c6 100644--- a/app/electron/main.js+++ b/app/electron/main.js@@ -981,6 +981,18 @@ app.whenReady().then(() => {globalShortcut.unregister(hotKey2Electron(data.accelerator));}break;+ case "registerGlobalShortcut":+ if (data.accelerator) {+ globalShortcut.unregister(hotKey2Electron(data.accelerator));+ globalShortcut.register(hotKey2Electron(data.accelerator), () => {+ BrowserWindow.getAllWindows().forEach(itemB => {+ itemB.webContents.send("siyuan-hotkey", {+ hotkey: data.accelerator+ });+ });+ });+ }+ break;case "setTrafficLightPosition":if (!currentWindow || !currentWindow.setWindowButtonPosition) {return;diff --git a/app/src/plugin/index.ts b/app/src/plugin/index.tsindex 2595c5a6a6..d86ccec045 100644--- a/app/src/plugin/index.ts+++ b/app/src/plugin/index.ts@@ -11,6 +11,9 @@ import {getDockByType, setTabPosition} from "../layout/tabUtil";///#elseimport {MobileCustom} from "../mobile/dock/MobileCustom";/// #endif+/// #if !BROWSER+import {ipcRenderer} from "electron";+/// #endifimport {hasClosestByAttribute} from "../protyle/util/hasClosest";import {BlockPanel} from "../block/Panel";import {Setting} from "./Setting";@@ -186,6 +189,14 @@ export class Plugin {console.error(`${this.name} - commands data is error and has been removed.`);} else {this.commands.push(command);+ /// #if !BROWSER+ if (command.globalCallback) {+ ipcRenderer.send(Constants.SIYUAN_CMD, {+ cmd: "registerGlobalShortcut",+ accelerator: command.customHotkey+ });+ }+ /// #endif}}diff --git a/app/src/plugin/uninstall.ts b/app/src/plugin/uninstall.tsindex 7f1e980793..0ff21a1b98 100644--- a/app/src/plugin/uninstall.ts+++ b/app/src/plugin/uninstall.ts@@ -5,6 +5,9 @@ import {getAllModels} from "../layout/getAll";import {resizeTopBar} from "../layout/util";import {setTabPosition} from "../layout/tabUtil";/// #endif+/// #if !BROWSER+import {ipcRenderer} from "electron";+/// #endifimport {Constants} from "../constants";import {setStorageVal} from "../protyle/util/compatibility";import {getAllEditor} from "../layout/getAll";@@ -85,6 +88,16 @@ export const uninstall = (app: App, name: string, isReload: boolean) => {});// rm styledocument.getElementById("pluginsStyle" + name)?.remove();+ /// #if !BROWSER+ plugin.commands.forEach(command => {+ if (command.globalCallback && command.customHotkey) {+ ipcRenderer.send(Constants.SIYUAN_CMD, {+ cmd: "unregisterGlobalShortcut",+ accelerator: command.customHotkey+ });+ }+ });+ /// #endifreturn true;}});