diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts index b86b376bf..424074025 100644 --- a/app/src/boot/globalEvent/keydown.ts +++ b/app/src/boot/globalEvent/keydown.ts @@ -1734,3 +1734,23 @@ export const sendGlobalShortcut = (app: App) => { }); /// #endif }; + + +export const sendUnregisterGlobalShortcut = (app:App) => { + /// #if !BROWSER + ipcRenderer.send(Constants.SIYUAN_CMD, { + cmd: "unregisterGlobalShortcut", + accelerator: window.siyuan.config.keymap.general.toggleWin.custom + }); + app.plugins.forEach(plugin => { + plugin.commands.forEach(command => { + if (command.globalCallback) { + ipcRenderer.send(Constants.SIYUAN_CMD, { + cmd: "unregisterGlobalShortcut", + accelerator: command.customHotkey + }); + } + }); + }); + /// #endif +} diff --git a/app/src/config/keymap.ts b/app/src/config/keymap.ts index bce4d0ce7..0335c068c 100644 --- a/app/src/config/keymap.ts +++ b/app/src/config/keymap.ts @@ -7,6 +7,7 @@ import {confirmDialog} from "../dialog/confirmDialog"; import {App} from "../index"; /// #if !BROWSER import {ipcRenderer} from "electron"; +import {sendUnregisterGlobalShortcut} from "../boot/globalEvent/keydown"; /// #endif import {sendGlobalShortcut} from "../boot/globalEvent/keydown"; @@ -61,7 +62,7 @@ export const keymap = { const dockKeymap = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name]; const keyValue = updateHotkeyTip(dockKeymap.custom); commandHTML += `