Repository navigation
Conversation
A key remapper such as keyd holds the Apple SPI Keyboard with EVIOCGRAB, so no Fn events reach the service and the Touch Bar never switches to the function keys. The kernel key state still tracks Fn under a grab, so read it with EVIOCGKEY on each loop iteration that brought no Fn event. Fixes standardagents#55
This branch has not been deployed
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.
Fixes #55.
When keyd or another remapper grabs Apple SPI Keyboard with EVIOCGRAB, the service never sees a KEY_FN event and the Touch Bar stays on the controls. The kernel key state still follows Fn under a grab, so when the Fn descriptor was not readable, process_input() now reads it with
function.pressed()(EVIOCGKEY, as on SYN_DROPPED) and passes it to set_fn_pressed(), which ignores an unchanged state.This relies on wait_events() returning at least every INPUT_WAIT_MS, which the comment in the code says. 546F6E79 checked in #55 that keyd's virtual keyboard does not declare KEY_FN, so following that device instead is not an option.
Tested on a MacBookPro14,3 with CachyOS and keyd 2.6.0, where it has run since 2026-10-23: Fn switches the strip with keyd running.
cargo test -p t1-touchbar-hw --features servicepasses.