fix(macos): preserve Fn semantics for page navigation#429
Conversation
8eb6392 to
ef1e743
Compare
Greptile SummaryThis PR adds macOS Fn/Globe modifier support to the custom-shortcut system. It introduces
Confidence Score: 5/5Safe to merge — the core Fn+Arrow to Page Up/Page Down flow is well-tested and handles all four arrow directions correctly. The Fn+Arrow remapping and SecondaryFn flag logic are thoroughly tested and hardware-validated. The only gap is that direct Home/End key code shortcuts do not get SecondaryFn added automatically unlike Page Up/Down, but this affects only a manually-authored edge case not covered by the docs and does not regress any existing functionality. The SecondaryFn condition in crates/openlogi-inject/src/inject/macos.rs is worth a second look to decide whether Home/End should be treated consistently with Page Up/Down. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[CustomShortcut combo] --> B{MOD_FN set?}
B -->|Yes| C{Is key an arrow?}
C -->|Up 0x7E| D[Remap to PAGE_UP 0x74]
C -->|Down 0x7D| E[Remap to PAGE_DOWN 0x79]
C -->|Left 0x7B| F[Remap to HOME 0x73]
C -->|Right 0x7C| G[Remap to END 0x77]
C -->|other| H[Keep key_code as-is]
D --> I[Add SecondaryFn flag]
E --> I
F --> I
G --> I
H --> I
B -->|No| J{key_code is Page Up or Page Down?}
J -->|Yes| K[Add SecondaryFn flag]
J -->|No| L[No SecondaryFn flag]
I --> M[post_key with final key and flags]
K --> M
L --> M
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[CustomShortcut combo] --> B{MOD_FN set?}
B -->|Yes| C{Is key an arrow?}
C -->|Up 0x7E| D[Remap to PAGE_UP 0x74]
C -->|Down 0x7D| E[Remap to PAGE_DOWN 0x79]
C -->|Left 0x7B| F[Remap to HOME 0x73]
C -->|Right 0x7C| G[Remap to END 0x77]
C -->|other| H[Keep key_code as-is]
D --> I[Add SecondaryFn flag]
E --> I
F --> I
G --> I
H --> I
B -->|No| J{key_code is Page Up or Page Down?}
J -->|Yes| K[Add SecondaryFn flag]
J -->|No| L[No SecondaryFn flag]
I --> M[post_key with final key and flags]
K --> M
L --> M
Reviews (2): Last reviewed commit: "fix(macos): preserve fn page navigation" | Re-trigger Greptile |
ef1e743 to
9e46e7e
Compare
Summary
Add macOS Fn/Globe support to custom shortcuts 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.
Changes
openlogi-coreKeyCombo::MOD_FNas modifier bit0x10openlogi-injectMOD_FNtoCGEventFlagSecondaryFnon macOSCGEventFlagSecondaryFnTesting
cargo fmt --all -- --checkcargo test -p openlogi-core -p openlogi-inject --locked(99 core tests, 4 inject tests)cargo clippy -p openlogi-core -p openlogi-inject --all-targets --locked -- -D warningscargo test --workspace --exclude openlogi-gui --lockedcargo clippy --workspace --all-targets --locked -- -D warningsreached the GPUI macOS shader build and was blocked by the local Xcode installation missing the optional Metal ToolchainRelated to #101.