diff --git a/lib/python/qmk/cli/generate/community_modules.py b/lib/python/qmk/cli/generate/community_modules.py index cb8c3b9a77..80228ab473 100644 --- a/lib/python/qmk/cli/generate/community_modules.py +++ b/lib/python/qmk/cli/generate/community_modules.py @@ -47,6 +47,8 @@ def _render_keycodes(module_jsons): first = False else: lines.append(f' {key},') + for alias in keycode.get('aliases', []): + lines.append(f' {alias} = {key},') lines.append('') lines.append(' LAST_COMMUNITY_MODULE_KEY') lines.append('};') diff --git a/lib/python/qmk/json_encoders.py b/lib/python/qmk/json_encoders.py index c6822c22b2..e83a381d52 100755 --- a/lib/python/qmk/json_encoders.py +++ b/lib/python/qmk/json_encoders.py @@ -256,5 +256,10 @@ class CommunityModuleJSONEncoder(QMKJSONEncoder): return '03features' if key == 'keycodes': return '04keycodes' + elif self.indentation_level == 3: # keycodes + if key == 'key': + return '00key' + if key == 'aliases': + return '01aliases' return key diff --git a/modules/hello_world/hello_world.c b/modules/hello_world/hello_world.c index c259a25742..07c9c0625e 100644 --- a/modules/hello_world/hello_world.c +++ b/modules/hello_world/hello_world.c @@ -22,7 +22,7 @@ bool process_record_hello_world(uint16_t keycode, keyrecord_t *record) { } switch (keycode) { - case CM_HELLO: + case COMMUNITY_MODULE_HELLO: if (record->event.pressed) { SEND_STRING("Hello there."); break; diff --git a/modules/hello_world/qmk_module.json b/modules/hello_world/qmk_module.json index 1dbb1f6fbf..4f269cb4e9 100644 --- a/modules/hello_world/qmk_module.json +++ b/modules/hello_world/qmk_module.json @@ -5,6 +5,9 @@ "deferred_exec": true }, "keycodes": [ - { "key": "CM_HELLO" } + { + "key": "COMMUNITY_MODULE_HELLO", + "aliases": ["CM_HELO"] + } ] }