fix: 全局快捷键相关bug

master
qier222 4 years ago
parent bb87b7f20d
commit 14f47f8cfc
No known key found for this signature in database
GPG Key ID: 9C85007ED905F14D

@ -311,7 +311,7 @@ class Background {
this.window.setTouchBar(createTouchBar(this.window)); this.window.setTouchBar(createTouchBar(this.window));
// register global shortcuts // register global shortcuts
if (this.store.get('settings.enableGlobalShortcut')) { if (this.store.get('settings.enableGlobalShortcut') !== false) {
registerGlobalShortcut(this.window, this.store); registerGlobalShortcut(this.window, this.store);
} }
}); });

@ -71,6 +71,7 @@ export function initIpcMain(win, store) {
if (options.enableGlobalShortcut) { if (options.enableGlobalShortcut) {
registerGlobalShortcut(win, store); registerGlobalShortcut(win, store);
} else { } else {
log('unregister global shortcut');
globalShortcut.unregisterAll(); globalShortcut.unregisterAll();
} }
}); });
@ -120,6 +121,7 @@ export function initIpcMain(win, store) {
}); });
ipcMain.on('switchGlobalShortcutStatusTemporary', (e, status) => { ipcMain.on('switchGlobalShortcutStatusTemporary', (e, status) => {
log('switchGlobalShortcutStatusTemporary');
if (status === 'disable') { if (status === 'disable') {
globalShortcut.unregisterAll(); globalShortcut.unregisterAll();
} else { } else {

@ -24,7 +24,7 @@ let localStorage = {
lyricsBackground: true, lyricsBackground: true,
closeAppOption: 'ask', closeAppOption: 'ask',
enableDiscordRichPresence: false, enableDiscordRichPresence: false,
enableGlobalShortcut: false, enableGlobalShortcut: true,
showLibraryDefault: false, showLibraryDefault: false,
enabledPlaylistCategories, enabledPlaylistCategories,
proxyConfig: { proxyConfig: {

@ -978,6 +978,7 @@ export default {
this.recordedShortcut = []; this.recordedShortcut = [];
}, },
exitRecordShortcut() { exitRecordShortcut() {
if (this.shortcutInput.recording === false) return;
this.shortcutInput = { id: '', type: '', recording: false }; this.shortcutInput = { id: '', type: '', recording: false };
this.recordedShortcut = []; this.recordedShortcut = [];
ipcRenderer.send('switchGlobalShortcutStatusTemporary', 'enable'); ipcRenderer.send('switchGlobalShortcutStatusTemporary', 'enable');

Loading…
Cancel
Save