fix(statusbar): use Rust FFI for resolved hotkey display#37
Merged
Conversation
Cover the 7-key fallback chain for duplicate trigger/cancel keys and verify invalid key names fall back to defaults. These tests document the correct behavior that the status bar should match.
Add sp_config_resolved_trigger_key and sp_config_resolved_cancel_key that return the fully normalized and deduplicated hotkey names. This lets the ObjC layer get the exact keys the core will use, instead of parsing YAML independently.
The status bar was parsing config.yaml manually and using a binary fallback (fn ↔ left_option) for duplicate keys. The core uses a 7-key preference chain, so the displayed hotkey could differ from the actually active key (e.g. trigger=left_option, cancel=left_option would show "Fn" but core activates "Right Option"). Now uses sp_config_resolved_trigger_key/cancel_key FFI to get the exact keys the core will use.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The status bar parsed
config.yamlmanually and used a binary fallback(fn ↔ left_option) when trigger and cancel keys were the same. The core
uses a 7-key preference chain, so the displayed hotkey could differ from
the actually active key (e.g., trigger=left_option, cancel=left_option
would show "Fn" but core activates "Right Option").
What changed
sp_config_resolved_trigger_key()/sp_config_resolved_cancel_key()FFI functions that return the exact keys the core uses after normalization
and dedup.
SPStatusBarManagerwithtwo FFI calls.
Test plan
cargo test -p koe-core --lib— 5 hotkey tests passmakebuilds successfullyconfig.yaml — menu should show "Right Option", not "Fn"