2022-05-04 18:15:30 +01:00
# Stringy Keymaps
2022-04-29 19:21:16 +01:00
2023-01-25 10:17:38 +01:00
Enables referring to keys by `'NAME'` rather than `KC.NAME` .\
This extension allows for a seamless integration of both string-based key references and standard keycodes.
2022-04-29 19:21:16 +01:00
For example:
```python
2022-05-05 07:55:37 +01:00
from kmk.extensions.stringy_keymaps import StringyKeymaps
2022-04-29 19:21:16 +01:00
# Normal
# keyboard.keymap = [[ KC.A, KC.B, KC.RESET ]]
# Indexed
# keyboard.keymap = [[ KC['A'], KC['B'], KC['RESET'] ]]
2023-01-25 10:17:38 +01:00
# String names mixed with normal keycodes
# keyboard.keymap = [[ 'A' , KC.B, KC.RESET ]]
2022-04-29 19:21:16 +01:00
# String names
keyboard.keymap = [[ 'A' , 'B', 'RESET' ]]
2022-05-05 07:55:37 +01:00
stringyKeymaps = StringyKeymaps()
2022-04-29 19:21:16 +01:00
# Enabling debug will show each replacement or failure.
# This is recommended during the initial development of a keyboard.
2022-05-05 07:55:37 +01:00
# stringyKeymaps.debug_enable = True
2022-04-29 19:21:16 +01:00
2022-05-05 07:55:37 +01:00
keyboard.extensions.append(stringyKeymaps)
2022-04-29 19:21:16 +01: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.
2023-01-25 10:17:38 +01:00
2023-02-12 20:42:53 +01:00
When utilizing argumented keys, such as `KC.MO(layer)` , it's not possible to use a string like `'MO(layer)'` instead employ the standard notation of e.g. `KC.MO(1)` in your keymap.