Skip to content

fix(statusbar): use Rust FFI for resolved hotkey display#37

Merged
missuo merged 3 commits into
missuo:mainfrom
erning:fix/statusbar-hotkey-display
Mar 30, 2026
Merged

fix(statusbar): use Rust FFI for resolved hotkey display#37
missuo merged 3 commits into
missuo:mainfrom
erning:fix/statusbar-hotkey-display

Conversation

@erning

@erning erning commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator

Why

The status bar parsed config.yaml manually 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

  • Added sp_config_resolved_trigger_key() / sp_config_resolved_cancel_key()
    FFI functions that return the exact keys the core uses after normalization
    and dedup.
  • Replaced 50 lines of manual YAML parsing in SPStatusBarManager with
    two FFI calls.
  • Added 5 unit tests for hotkey normalization and the dedup chain.

Test plan

  • cargo test -p koe-core --lib — 5 hotkey tests pass
  • make builds successfully
  • Manual: set trigger_key=left_option, cancel_key=left_option in
    config.yaml — menu should show "Right Option", not "Fn"

erning added 3 commits March 30, 2026 11:07
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.
@missuo missuo merged commit 57f6df8 into missuo:main Mar 30, 2026
@erning erning deleted the fix/statusbar-hotkey-display branch March 30, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants