diff options
Diffstat (limited to 'lib/python/qmk/cli/generate')
-rw-r--r-- | lib/python/qmk/cli/generate/keycodes.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/python/qmk/cli/generate/keycodes.py b/lib/python/qmk/cli/generate/keycodes.py index 2ed84cd589..f5c646e0ea 100644 --- a/lib/python/qmk/cli/generate/keycodes.py +++ b/lib/python/qmk/cli/generate/keycodes.py @@ -8,6 +8,14 @@ from qmk.path import normpath from qmk.keycodes import load_spec +def _translate_group(group): + """Fix up any issues with badly chosen values + """ + if group == 'modifiers': + return 'modifier' + return group + + def _render_key(key): width = 7 if 'S(' in key: @@ -82,7 +90,7 @@ def _generate_helpers(lines, keycodes): for group, codes in temp.items(): lo = keycodes["keycodes"][f'0x{codes[0]:04X}']['key'] hi = keycodes["keycodes"][f'0x{codes[1]:04X}']['key'] - lines.append(f'#define IS_{ group.upper() }_KEYCODE(code) ((code) >= {lo} && (code) <= {hi})') + lines.append(f'#define IS_{ _translate_group(group).upper() }_KEYCODE(code) ((code) >= {lo} && (code) <= {hi})') def _generate_aliases(lines, keycodes): |