diff --git a/src/main/libs/ShortcutRegister.ts b/src/main/libs/ShortcutRegister.ts index 3a2e642d..dd689c50 100644 --- a/src/main/libs/ShortcutRegister.ts +++ b/src/main/libs/ShortcutRegister.ts @@ -5,7 +5,7 @@ const shortcutsStore = new Store({ name: 'shortcuts' }); const isDevelopment = process.env.NODE_ENV !== 'production'; export class ShortcutRegister { - shortcuts: ShortcutRecord[]; + private _shortcuts: ShortcutRecord[]; private _mainWindow: BrowserWindow; constructor (args: { mainWindow: BrowserWindow }) { @@ -13,6 +13,15 @@ export class ShortcutRegister { this.shortcuts = shortcutsStore.get('shortcuts', defaultShortcuts) as ShortcutRecord[]; } + get shortcuts () { + return this._shortcuts; + } + + private set shortcuts (value: ShortcutRecord[]) { + this._shortcuts = value; + shortcutsStore.set('shortcuts', value); + } + init () { for (const shortcut of this.shortcuts) { if (shortcut.os.includes(process.platform)) { @@ -39,10 +48,10 @@ export class ShortcutRegister { updateShortcuts (shortcuts: ShortcutRecord[]) { this.shortcuts = shortcuts; + this.reload(); } restoreDefaults () { - shortcutsStore.set('shortcuts', defaultShortcuts); this.shortcuts = defaultShortcuts; this.reload(); } diff --git a/src/renderer/components/ModalSettings.vue b/src/renderer/components/ModalSettings.vue index 00307371..55e04835 100644 --- a/src/renderer/components/ModalSettings.vue +++ b/src/renderer/components/ModalSettings.vue @@ -289,6 +289,9 @@ +