From 14f47f8cfc80e1de3ba4857c9aec3861346d3e59 Mon Sep 17 00:00:00 2001 From: qier222 Date: Sat, 25 Sep 2021 19:10:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=85=A8=E5=B1=80=E5=BF=AB=E6=8D=B7?= =?UTF-8?q?=E9=94=AE=E7=9B=B8=E5=85=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/background.js | 2 +- src/electron/ipcMain.js | 2 ++ src/store/initLocalStorage.js | 2 +- src/views/settings.vue | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/background.js b/src/background.js index c71d137..b3c90cb 100644 --- a/src/background.js +++ b/src/background.js @@ -311,7 +311,7 @@ class Background { this.window.setTouchBar(createTouchBar(this.window)); // register global shortcuts - if (this.store.get('settings.enableGlobalShortcut')) { + if (this.store.get('settings.enableGlobalShortcut') !== false) { registerGlobalShortcut(this.window, this.store); } }); diff --git a/src/electron/ipcMain.js b/src/electron/ipcMain.js index e641f67..2a89a95 100644 --- a/src/electron/ipcMain.js +++ b/src/electron/ipcMain.js @@ -71,6 +71,7 @@ export function initIpcMain(win, store) { if (options.enableGlobalShortcut) { registerGlobalShortcut(win, store); } else { + log('unregister global shortcut'); globalShortcut.unregisterAll(); } }); @@ -120,6 +121,7 @@ export function initIpcMain(win, store) { }); ipcMain.on('switchGlobalShortcutStatusTemporary', (e, status) => { + log('switchGlobalShortcutStatusTemporary'); if (status === 'disable') { globalShortcut.unregisterAll(); } else { diff --git a/src/store/initLocalStorage.js b/src/store/initLocalStorage.js index 59b50cd..7e642a2 100644 --- a/src/store/initLocalStorage.js +++ b/src/store/initLocalStorage.js @@ -24,7 +24,7 @@ let localStorage = { lyricsBackground: true, closeAppOption: 'ask', enableDiscordRichPresence: false, - enableGlobalShortcut: false, + enableGlobalShortcut: true, showLibraryDefault: false, enabledPlaylistCategories, proxyConfig: { diff --git a/src/views/settings.vue b/src/views/settings.vue index 04b6819..eaf6a0b 100644 --- a/src/views/settings.vue +++ b/src/views/settings.vue @@ -978,6 +978,7 @@ export default { this.recordedShortcut = []; }, exitRecordShortcut() { + if (this.shortcutInput.recording === false) return; this.shortcutInput = { id: '', type: '', recording: false }; this.recordedShortcut = []; ipcRenderer.send('switchGlobalShortcutStatusTemporary', 'enable');