Repository navigation
🐞 Track physical Fn state so media keys don't trigger Loop - #1184
Draft
root-daemon wants to merge 1 commit into
Draft
root-daemon wants to merge 1 commit into
root-daemon wants to merge 1 commit into
Conversation
macOS adds the Fn flag to volume/brightness keys, and KeybindTrigger used the previous event's flags to decide whether Fn was held for arrow and F-keys. A media key press therefore made the next arrow key look like Globe + Arrow and opened Loop. Fn is now only considered held after a flagsChanged event for the Fn key itself. Fixes mrkai77#1139
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.
Description
macOS adds the Fn flag to volume and brightness keys (as well as arrows and F-keys) even when Fn isn't held.
KeybindTriggerdecided whether to keep the Fn flag on arrow/F-keys by looking at the previous event's flags, so after a media key press the next arrow key looked like Globe + Arrow and opened Loop with the matching action.As suggested in the issue, this tracks Fn's physical state separately in a small
FnKeyStatehelper:flagsChangedevent for the Fn key itself.Only the existing
isFnSpecialKeykeys have the flag stripped, so other keys behave as before.Fixes #1139
How has this been tested?
FnKeyStateTests(media key → arrow, real Fn + arrow, Fn release, missed release, other modifiers while holding Fn, non-special keys). All pass.KeybindResolverTestspass.Note: on
develop, the test target doesn't compile becauseCycleProgressStoreTests.swiftuses APIs that no longer exist, andCycleActionCoordinatorTests.selectingCurrentFromOutsideResumesStoredProgressfails. Both happen without this change; I set that file aside locally to run the suite.Checklist:
Please describe to which degree, if any, an LLM was used in creating this pull request.
I used Claude Code (Anthropic's Claude Opus 5.5) to find the root cause, write the
FnKeyStatechange and its unit tests, and draft this description. The unit tests have been run. My own review of the code and the manual checks above are still pending, which is why this is a draft; I'll mark it ready for review once both are done on my Mac.🤖 Generated with Claude Code