diff --git a/native/hotkey.js b/native/hotkey.js index 536a8c6..a85055b 100644 --- a/native/hotkey.js +++ b/native/hotkey.js @@ -35,7 +35,18 @@ async function configHotkey(config) { Object.keys(config).forEach((key) => { if (!HotKeyFunctionMap[key] || NotRegisterMap[env.platform][key]) return; // 如果没有对应的处理函数,则直接返回 if (!config[key]) return; - globalShortcut.register(config[key], HotKeyFunctionMap[key]); + function registerShortcut(k) { + globalShortcut.register(config[k], HotKeyFunctionMap[k]); + // mac系统允许注册相同的快捷键 + const isRegistered = globalShortcut.isRegistered(config[k]); + // 如果注册失败,自动再注册 + if (!isRegistered) { + setTimeout(() => { + registerShortcut(k); + }, 2000); + } + } + registerShortcut(key); }) } diff --git a/package.json b/package.json index f7eb0c6..f53ca3e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rishiqing-electron", - "version": "3.1.10", + "version": "3.1.11", "author": "北京创仕科锐信息技术有限责任公司", "electronVersion": "3.0.10", "main": "main.js",