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

Add custom keycode support to JSON files #6873

Closed
2 of 4 tasks
skullydazed opened this issue Oct 2, 2019 · 9 comments
Closed
2 of 4 tasks

Add custom keycode support to JSON files #6873

skullydazed opened this issue Oct 2, 2019 · 9 comments
Labels
cli qmk cli command enhancement hacktoberfest-accepted All the good issues to tackle during Hacktoberfest! help wanted python to do

Comments

@skullydazed
Copy link
Member

Feature Request Type

  • Core functionality
  • Add-on hardware support (eg. audio, RGB, OLED screen, etc.)
  • Alteration (enhancement/optimization) of existing feature(s)
  • New behavior

Description

When a JSON file is compiled (qmk compile configurator_export.json) it's currently not possible to use custom keycodes. We should add a new key, custom_keycodes, which the user can populate.

For the initial implementation we should add this to the keyboard template:

enum custom_keycodes {
__CUSTOM_KEYCODES_HERE__
}

We will then need to extend the generate() function in lib/python/qmk/keymap.py to also generate and write values for this enum.

This feature will not be immediately useful but other features (such as macros and interacting with userspace code) will build on this feature.

@skullydazed skullydazed added enhancement hacktoberfest-accepted All the good issues to tackle during Hacktoberfest! help wanted python cli qmk cli command labels Oct 2, 2019
@mi11y
Copy link
Contributor

mi11y commented Oct 6, 2019

Would this go in the quantum/template/base/keymaps/default/keymap.c template? Or in the DEFAULT_KEYMAP_C in keymap.py?

I see where __CUSTOM_KEYCODES_HERE__ would be used in keymap.py. I think we would be adding a keymap_c.replace('__CUSTOM_KEYCODES_HERE__', custom_keycodes)? In a configurator export, are custom keycodes ANY(<custom keycode>)?

@skullydazed
Copy link
Member Author

It would go into keymap.py.

There is currently no way to specify a custom keycode in configurator exports. This issue is a step towards being able to specify custom keycodes in configurator.

@mi11y
Copy link
Contributor

mi11y commented Oct 6, 2019

So just placing an enum in the default template? mi11y@3b451a1

Are there any keymap.c files in the repo that define custom keycodes? I have a fair idea of how layers and keycodes are taken from the JSON in keymap.py/

@skullydazed
Copy link
Member Author

skullydazed commented Oct 6, 2019

It should go above the layer definition but yes you're on the right track there. The next step will be to extend a configurator export with "custom_keycodes": ["CUSTOM1", "CUSTOM2"] and then write the code to populate that.

The documentation for custom keycodes is here: https://docs.qmk.fm/#/custom_quantum_functions?id=custom-keycodes

@ShiftyBlock
Copy link

I'm currently confused about the process of doing this, is this already in the making?

@mi11y
Copy link
Contributor

mi11y commented Oct 27, 2019

I think (might be wrong here) a good place to start would be to look in lib/python/qmk/keymap.py. At the top there should be a __KEYMAP_GOES_HERE__ marker. This whole python string gets turned into a keymap.c file, and I think its done within keymap.py.

This python code will go through a configurator export JSON and extract out the keycodes and keymap and format them into the C keymaps[].

@stale
Copy link

stale bot commented Jan 25, 2020

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs.
For maintainers: Please label with bug, in progress, on hold, discussion or to do to prevent the issue from being re-flagged.

@stale stale bot added the stale Issues or pull requests that have become inactive without resolution. label Jan 25, 2020
@skullydazed skullydazed added to do and removed stale Issues or pull requests that have become inactive without resolution. labels Jan 25, 2020
@Anika-Roy
Copy link

Hi! Im participating in Hacktoberfest and I'd like to know if this issue is counted in Hacktoberfest and if I can work on it?

@zvecr
Copy link
Member

zvecr commented Nov 14, 2023

Implemented in #19925

@zvecr zvecr closed this as completed Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli qmk cli command enhancement hacktoberfest-accepted All the good issues to tackle during Hacktoberfest! help wanted python to do
Projects
None yet
Development

No branches or pull requests

5 participants