mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-07-08 16:52:02 +08:00
🚧 WIP: finished shortKey page
This commit is contained in:
@@ -452,8 +452,8 @@ ipcMain.on('uploadChoosedFiles', async (evt, files) => {
|
||||
return uploadChoosedFiles(evt.sender, files)
|
||||
})
|
||||
|
||||
ipcMain.on('updateShortKey', (evt, item) => {
|
||||
shortKeyUpdater(globalShortcut, item)
|
||||
ipcMain.on('updateShortKey', (evt, item, oldKey) => {
|
||||
shortKeyUpdater(globalShortcut, item, oldKey)
|
||||
const notification = new Notification({
|
||||
title: '操作成功',
|
||||
body: '你的快捷键已经修改成功'
|
||||
|
||||
@@ -11,7 +11,17 @@ const shortKeyHandler = (name) => {
|
||||
}
|
||||
}
|
||||
|
||||
const shortKeyUpdater = (globalShortcut, item) => {
|
||||
/**
|
||||
* 用于更新快捷键绑定
|
||||
* @param {globalShortcut} globalShortcut
|
||||
* @param {keyObject} item
|
||||
* @param {string} oldKey
|
||||
*/
|
||||
const shortKeyUpdater = (globalShortcut, item, oldKey) => {
|
||||
// 如果提供了旧key,则解绑
|
||||
if (oldKey) {
|
||||
globalShortcut.unregister(oldKey)
|
||||
}
|
||||
if (item.enable === false) {
|
||||
globalShortcut.unregister(item.key)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user