Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor key types #988

Merged
merged 3 commits into from
Jun 27, 2024
Merged

Refactor key types #988

merged 3 commits into from
Jun 27, 2024

Conversation

xs5871
Copy link
Collaborator

@xs5871 xs5871 commented Jun 13, 2024

Here's the beginning of something I wanted to do for a long time: Use pythons typing system to distinguish key types, i.e. use actual classes instead the self-made type system that compares fake key codes against FIRST_KMK_INTERNAL_KEY.
Also gone: secretly changing the meaning of keys with the has_modifiers attribute. Modified keys are now their own class, they work for any key (including for example mouse and media), not just keyboard HID -- a limitation that was never documented in the first place. Shifted keys are handled by the ModifiedKeys handlers and are no longer a special case deep inside hid.py, which will make resolving issues like #642 easier.

Coming soon: getting rid of key.meta, aka: "we already use classes for key types, but only sometimes, and we hide it behind a layer of indirection".

@xs5871 xs5871 merged commit 68dc38e into main Jun 27, 2024
3 checks passed
@xs5871 xs5871 deleted the refactor-key-types branch June 27, 2024 06:29
@xs5871 xs5871 mentioned this pull request Jun 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants