fix(macos): preserve Fn semantics for page navigation - #429
Open
devsaddle wants to merge 1 commit into
Open
Conversation
devsaddle
force-pushed
the
fix/macos-fn-page-navigation
branch
from
July 19, 2026 17:31
8eb6392 to
ef1e743
Compare
devsaddle
marked this pull request as ready for review
July 19, 2026 17:31
Greptile SummaryThis PR adds macOS Fn/Globe modifier support to the custom shortcut system, ensuring synthesized page navigation events match what a physical Fn+Arrow keypress produces rather than the short-scroll behavior seen from flagged arrow events.
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| crates/openlogi-core/src/binding/key_combo.rs | Adds MOD_FUNCTION (bit 0x10), has_function() predicate, "Fn"/"function"/"globe" token parsing, and "Fn" prefix in rendered_label(). Bit allocation is clean, ALL_MODIFIERS mask updated, TOML roundtrip verified by new tests. |
| crates/openlogi-inject/src/inject/macos.rs | Extracts keycombo_event() from post_keycombo(), maps MOD_FUNCTION to CGEventFlagSecondaryFn, and remaps all four Fn+Arrow combos to their native navigation VK codes (Home/End/PageUp/PageDown). PageUp/PageDown also get SecondaryFn unconditionally, matching physical keyboard behavior. All four arrow mappings are covered by new unit tests. |
| crates/openlogi-inject/examples/inject_action.rs | Help text updated from legacy hex-code format to the canonical chord string format, including an Fn+Down example. Straightforward documentation-only change. |
| docs/CONFIGURATION.md | Documents the new Fn modifier, its macOS-only semantics, and the Fn+arrow TOML examples. Accurate description of the SecondaryFn flag behavior for both synthesised navigation events and direct PageUp/PageDown. |
Sequence Diagram
sequenceDiagram
participant User as User Config (TOML)
participant Parser as KeyCombo Parser
participant Executor as macOS Executor
participant CG as CoreGraphics
User->>Parser: "Fn+Down" / "PageDown"
Parser->>Parser: parse_modifier("Fn") → MOD_FUNCTION (0x10)
Parser->>Parser: parse_key("Down") → HID usage 0x51
Parser-->>Executor: "KeyCombo { modifiers: 0x10, key: 0x51 }"
Executor->>Executor: keycombo_event(combo)
Note over Executor: has_function() = true<br/>usage = 0x51 (Down)<br/>→ flags |= SecondaryFn
Executor->>Executor: "match 0x51 => vk = 0x79 (kVK_PageDown)"
Executor->>CG: "post_key(vk=0x79, flags=SecondaryFn)"
CG-->>CG: CGEvent KeyDown(PageDown) + SecondaryFn
CG-->>CG: CGEvent KeyUp(PageDown) + SecondaryFn
Note over User,CG: Direct PageDown (HID 0x4e) also gets SecondaryFn via<br/>matches!(usage, 0x4b | 0x4e) shortcut path
Reviews (3): Last reviewed commit: "fix(macos): preserve fn page navigation" | Re-trigger Greptile
devsaddle
force-pushed
the
fix/macos-fn-page-navigation
branch
from
July 20, 2026 09:54
ef1e743 to
9e46e7e
Compare
devsaddle
force-pushed
the
fix/macos-fn-page-navigation
branch
from
August 16, 2026 16:12
9e46e7e to
df3e1ed
Compare
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.
Summary
Add macOS Fn/Globe support to the current platform-neutral
KeyCombomodel and reproduce the native navigation-key event representation. This makes synthesized page navigation match physical Fn+Up/Fn+Down instead of producing the shorter scroll behavior seen with flagged arrow-key events.This revision rebases the original fix onto the current
master, including the USB HID shortcut vocabulary and platform-neutral Effect IR introduced since the PR was opened.Changes
openlogi-core0x10in the validated binary shortcut representationFn,Function, andGlobealiases and render the canonical modifier firstopenlogi-injectCGEventFlagSecondaryFnon macOSCGEventFlagSecondaryFnfor direct Page Up/Page Down shortcutsCustomShortcut:<chord>syntaxFn+Down/Fn+UpTOML shortcuts and macOS-only Fn behaviorTesting
cargo fmt --allcargo test -p openlogi-core -p openlogi-inject --locked(192 core tests, 5 inject tests)cargo clippy -p openlogi-core -p openlogi-inject --all-targets --locked -- -D warningsThe original implementation was hardware-validated with an MX Master 2S in Safari and Chrome. The rebased implementation preserves the same macOS event behavior through the new HID-usage shortcut model.
Related to #101.