From ce64e2e45015f03c39d0b5df9ed0f386bdff685b Mon Sep 17 00:00:00 2001 From: millionart Date: Mon, 4 May 2026 21:27:06 +0800 Subject: [PATCH] fix: preserve legacy Fn hotkey on Windows --- openless-all/app/src-tauri/src/types.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/openless-all/app/src-tauri/src/types.rs b/openless-all/app/src-tauri/src/types.rs index e861f0ee..4819437b 100644 --- a/openless-all/app/src-tauri/src/types.rs +++ b/openless-all/app/src-tauri/src/types.rs @@ -346,6 +346,9 @@ fn legacy_trigger_code(trigger: HotkeyTrigger) -> &'static str { HotkeyTrigger::RightControl => "ControlRight", HotkeyTrigger::LeftControl => "ControlLeft", HotkeyTrigger::RightCommand => "MetaRight", + #[cfg(target_os = "windows")] + HotkeyTrigger::Fn => "ControlRight", + #[cfg(not(target_os = "windows"))] HotkeyTrigger::Fn => "Fn", } } @@ -660,6 +663,15 @@ mod tests { assert_eq!(binding.display_label(), "右 Control"); } + #[cfg(target_os = "windows")] + #[test] + fn legacy_fn_trigger_uses_windows_control_right_alias() { + let binding: HotkeyBinding = + serde_json::from_str(r#"{"trigger":"fn","mode":"toggle"}"#).unwrap(); + + assert_eq!(binding.effective_codes(), vec!["ControlRight".to_string()]); + } + #[test] fn hotkey_binding_supports_combo_side_keys_mouse_and_double_click_mode() { let binding = HotkeyBinding {