-
Notifications
You must be signed in to change notification settings - Fork 129
fix(windows): 修复 OpenLess 前台主窗口热键失效 #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -166,6 +166,9 @@ pub fn run() { | |
| commands::read_credential, | ||
| commands::set_active_asr_provider, | ||
| commands::set_active_llm_provider, | ||
| commands::is_debug_ui_key_events_enabled, | ||
| commands::debug_log_ui_key_event, | ||
| commands::handle_window_hotkey_event, | ||
| restart_app, | ||
| ]) | ||
| .build(tauri::generate_context!()) | ||
|
|
@@ -175,9 +178,15 @@ pub fn run() { | |
| RunEvent::Reopen { .. } => show_main_window(app), | ||
| RunEvent::WindowEvent { label, event, .. } => { | ||
| if label == "main" { | ||
| if let tauri::WindowEvent::CloseRequested { api, .. } = event { | ||
| api.prevent_close(); | ||
| hide_main_window(app); | ||
| match event { | ||
| tauri::WindowEvent::Focused(focused) => { | ||
| log::info!("[window] main focused={focused}"); | ||
|
Comment on lines
+182
to
+183
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Losing window focus while the hotkey is held can leave Because |
||
| } | ||
| tauri::WindowEvent::CloseRequested { api, .. } => { | ||
| api.prevent_close(); | ||
| hide_main_window(app); | ||
| } | ||
| _ => {} | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (bug_risk): The Tauri command argument names don't match the keys used in the frontend invoke payload, which will likely break deserialization.
On the TS side,
handleWindowHotkeyEventis invoked with{ eventType, key, code, repeat }, so Tauri expects arguments with those exact names. The Rust command usesevent_type: String, which won’t matcheventType, so deserialization will fail at runtime. Please either align the Rust parameter names with the JS keys, use a struct with#[serde(rename = "eventType")](and similar for others), or update the frontend payload to use snake_case. The same mismatch exists fordebug_log_ui_key_event(eventTypevsevent_type).