mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 19:18:13 -05:00
parent
f40a1bb981
commit
4f0809e6b3
@ -24,11 +24,14 @@ class ShortKeyHandler {
|
|||||||
const commands = db.get('settings.shortKey') as IShortKeyConfigs
|
const commands = db.get('settings.shortKey') as IShortKeyConfigs
|
||||||
Object.keys(commands)
|
Object.keys(commands)
|
||||||
.filter(item => item.includes('picgo:'))
|
.filter(item => item.includes('picgo:'))
|
||||||
.map(command => {
|
.forEach(command => {
|
||||||
const config = commands[command]
|
const config = commands[command]
|
||||||
|
// if disabled, don't register #534
|
||||||
|
if (config.enable) {
|
||||||
globalShortcut.register(config.key, () => {
|
globalShortcut.register(config.key, () => {
|
||||||
this.handler(command)
|
this.handler(command)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
private initPluginsShortKey () {
|
private initPluginsShortKey () {
|
||||||
@ -46,7 +49,10 @@ class ShortKeyHandler {
|
|||||||
const command = `${item}:${cmd.name}`
|
const command = `${item}:${cmd.name}`
|
||||||
if (db.has(`settings.shortKey[${command}]`)) {
|
if (db.has(`settings.shortKey[${command}]`)) {
|
||||||
const commandConfig = db.get(`settings.shortKey.${command}`) as IShortKeyConfig
|
const commandConfig = db.get(`settings.shortKey.${command}`) as IShortKeyConfig
|
||||||
|
// if disabled, don't register #534
|
||||||
|
if (commandConfig.enable) {
|
||||||
this.registerShortKey(commandConfig, command, cmd.handle, false)
|
this.registerShortKey(commandConfig, command, cmd.handle, false)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
this.registerShortKey(cmd, command, cmd.handle, true)
|
this.registerShortKey(cmd, command, cmd.handle, true)
|
||||||
}
|
}
|
||||||
@ -65,6 +71,8 @@ class ShortKeyHandler {
|
|||||||
} else {
|
} else {
|
||||||
logger.warn(`${command} do not provide a key to bind`)
|
logger.warn(`${command} do not provide a key to bind`)
|
||||||
}
|
}
|
||||||
|
// if the configfile already had this command
|
||||||
|
// then writeFlag -> false
|
||||||
if (writeFlag) {
|
if (writeFlag) {
|
||||||
picgo.saveConfig({
|
picgo.saveConfig({
|
||||||
[`settings.shortKey.${command}`]: {
|
[`settings.shortKey.${command}`]: {
|
||||||
|
Loading…
Reference in New Issue
Block a user