kmk_firmware/docs/extension_stringy_keymaps.md

30 lines
748 B
Markdown
Raw Normal View History

2022-05-04 19:15:30 +02:00
# Stringy Keymaps
2022-04-29 20:21:16 +02:00
Enables referring to keys by `'NAME'` rather than `KC.NAME`.
2022-04-29 20:21:16 +02:00
For example:
```python
2022-05-05 08:55:37 +02:00
from kmk.extensions.stringy_keymaps import StringyKeymaps
2022-04-29 20:21:16 +02:00
# Normal
# keyboard.keymap = [[ KC.A, KC.B, KC.RESET ]]
# Indexed
# keyboard.keymap = [[ KC['A'], KC['B'], KC['RESET'] ]]
# String names
keyboard.keymap = [[ 'A' , 'B', 'RESET' ]]
2022-05-05 08:55:37 +02:00
stringyKeymaps = StringyKeymaps()
2022-04-29 20:21:16 +02:00
# Enabling debug will show each replacement or failure.
# This is recommended during the initial development of a keyboard.
2022-05-05 08:55:37 +02:00
# stringyKeymaps.debug_enable = True
2022-04-29 20:21:16 +02:00
2022-05-05 08:55:37 +02:00
keyboard.extensions.append(stringyKeymaps)
2022-04-29 20:21:16 +02:00
```
It should be noted that these are **not** ASCII. The string is **not** what
will be sent to the computer. The examples above have no functional difference.