Conversation
fn_lock: Option<bool> and the agent-side write path (HID++ 0x40a2/0x40a3, apply_fn_locks in the orchestrator) have existed for a while, but nothing in the GUI ever let a user set it -- grepping openlogi-desktop for fn_lock turned up nothing. The only way to change Fn-lock was the keyboard's own onboard toggle, with no way to see or set the state OpenLogi persists and re-applies on reconnect. Add a Switch to the Device tab's configuration card, shown only for keyboards, wired to a new Config::set_fn_lock accessor mirroring the existing set_invert_scroll/set_dpi_presets pair. No wire or schema change -- fn_lock already round-trips through config.toml. Fixes AprilNEA#1310
|
current_device_supports_fn_lock() only checked DeviceKind::Keyboard, so a keyboard exposing neither 0x40a2 nor 0x40a3 still showed and persisted the toggle while the background hardware write silently logged an unsupported-feature error and changed nothing — the UI kept reporting a state the device never applied. Adds Capabilities::fn_lock, derived from the feature table like every other capability flag, and gates the toggle on it instead of kind. Capabilities rides the IPC wire, so this bumps PROTOCOL_VERSION 31->32 and regenerates the wire_format golden. Addresses the Greptile P1 finding on AprilNEA#1450.
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
fn_lock: Option<bool>and its agent-side write path (apply_fn_locksin the orchestrator, driving HID++0x40a2/0x40a3) already exist, but nothing in the GUI could set it — I grepped all ofopenlogi-desktopand found zero references tofn_lockbefore this change. See [Feature]: MX Keys键盘功能区按键映射太少 #1310 (the linked comment specifically asks for "Fn+Esc toggle for hardware Fn-Lock").Changes
crates/openlogi-core/src/config.rs:Config::set_fn_lockaccessor, mirroring the existingset_invert_scroll/set_dpi_presetspair (fn_lock's reader already existed).crates/openlogi-desktop/src/state/fn_lock.rs(new):AppState::current_device_supports_fn_lock/current_fn_lock/commit_fn_lock, following the same shape asstate/scroll.rs'sinvert_scrollwiring.crates/openlogi-desktop/src/app/detail.rs: a Fn-lockSwitchrow in the Device tab's existing configuration card, shown only when the active device is a keyboard.crates/openlogi-ui/locales/*.toml: two new keys (device.fn_lock,device.fn_lock_description), added at the same position in every catalog; non-English catalogs carry the English text pending Crowdin translation.Scope
This only covers the Fn-lock toggle. The other two asks in #1310's comment (Fn as a live chord modifier for custom shortcuts, and independent F13–F19 press vs. Fn+press overrides) are much larger — new OS-hook-layer work and a real product-design question respectively — and are intentionally left out of this PR.
Testing
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspace(all green, including a new test instate::fn_lock::testscovering the default-false/toggle round trip)cargo test -p openlogi-ui locale(catalog parity) andcargo test -p openlogi-desktop i18ncargo doc --workspace --no-deps --document-private-items(excluding the GPUI crates)config.tomlbefore merging.Fixes #1310