fix: Quick Assistant cannot register shortcuts leading to inability to call out #11071(#11071)

* 修复快捷助手无法呼出的问题

* Apply suggestion from @Copilot

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: SuYao <sy20010504@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
SagoLu 2025-12-08 11:43:45 +08:00 committed by GitHub
parent d35434b6d6
commit 0cc4c96bc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -35,6 +35,15 @@ function getShortcutHandler(shortcut: Shortcut) {
}
case 'mini_window':
return () => {
// 在处理器内部检查QuickAssistant状态而不是在注册时检查
const quickAssistantEnabled = configManager.getEnableQuickAssistant()
logger.info(`mini_window shortcut triggered, QuickAssistant enabled: ${quickAssistantEnabled}`)
if (!quickAssistantEnabled) {
logger.warn('QuickAssistant is disabled, ignoring mini_window shortcut trigger')
return
}
windowService.toggleMiniWindow()
}
case 'selection_assistant_toggle':
@ -190,11 +199,10 @@ export function registerShortcuts(window: BrowserWindow) {
break
case 'mini_window':
//available only when QuickAssistant enabled
if (!configManager.getEnableQuickAssistant()) {
return
}
// 移除注册时的条件检查,在处理器内部进行检查
logger.info(`Processing mini_window shortcut, enabled: ${shortcut.enabled}`)
showMiniWindowAccelerator = formatShortcutKey(shortcut.shortcut)
logger.debug(`Mini window accelerator set to: ${showMiniWindowAccelerator}`)
break
case 'selection_assistant_toggle':