🚧 WIP: shortcut setting page

This commit is contained in:
PiEgg
2019-09-11 15:31:27 +08:00
parent f491209bd6
commit 1274893154
8 changed files with 203 additions and 32 deletions

View File

@@ -11,6 +11,16 @@ const shortKeyHandler = (name) => {
}
}
const shortKeyUpdater = (globalShortcut, item) => {
if (item.enable === false) {
globalShortcut.unregister(item.key)
} else {
globalShortcut.register(item.key, () => {
shortKeyHandler(item.name)
})
}
}
// 初始化阶段的注册
const initShortKeyRegister = (globalShortcut, shortKeys) => {
let errorList = []
@@ -28,5 +38,6 @@ const initShortKeyRegister = (globalShortcut, shortKeys) => {
}
export {
shortKeyUpdater,
initShortKeyRegister
}