@@ -24,11 +24,14 @@ class ShortKeyHandler {
2424 const commands = db . get ( 'settings.shortKey' ) as IShortKeyConfigs
2525 Object . keys ( commands )
2626 . filter ( item => item . includes ( 'picgo:' ) )
27- . map ( command => {
27+ . forEach ( command => {
2828 const config = commands [ command ]
29- globalShortcut . register ( config . key , ( ) => {
30- this . handler ( command )
31- } )
29+ // if disabled, don't register #534
30+ if ( config . enable ) {
31+ globalShortcut . register ( config . key , ( ) => {
32+ this . handler ( command )
33+ } )
34+ }
3235 } )
3336 }
3437 private initPluginsShortKey ( ) {
@@ -46,7 +49,10 @@ class ShortKeyHandler {
4649 const command = `${ item } :${ cmd . name } `
4750 if ( db . has ( `settings.shortKey[${ command } ]` ) ) {
4851 const commandConfig = db . get ( `settings.shortKey.${ command } ` ) as IShortKeyConfig
49- this . registerShortKey ( commandConfig , command , cmd . handle , false )
52+ // if disabled, don't register #534
53+ if ( commandConfig . enable ) {
54+ this . registerShortKey ( commandConfig , command , cmd . handle , false )
55+ }
5056 } else {
5157 this . registerShortKey ( cmd , command , cmd . handle , true )
5258 }
@@ -65,6 +71,8 @@ class ShortKeyHandler {
6571 } else {
6672 logger . warn ( `${ command } do not provide a key to bind` )
6773 }
74+ // if the configfile already had this command
75+ // then writeFlag -> false
6876 if ( writeFlag ) {
6977 picgo . saveConfig ( {
7078 [ `settings.shortKey.${ command } ` ] : {
0 commit comments