diff --git a/docs/en/keycodes.md b/docs/en/keycodes.md index bdd485f..856b2a6 100644 --- a/docs/en/keycodes.md +++ b/docs/en/keycodes.md @@ -188,6 +188,7 @@ | `KC.RESET` | Restarts the keyboard | | `KC.RELOAD`, `KC.RLD` | Reloads the keyboard software, preserving any serial connections | | `KC.DEBUG` | Toggle `debug_enabled`, which enables log spew to serial console | +| `KC.ANY` | Any key between `A and `/` | | `KC.GESC` | Escape when tapped, ` when pressed with Shift or GUI | | `KC.BKDL` | Backspace when tapped, Delete when pressed with GUI | | `KC.UC_MODE_NOOP` | Sets UnicodeMode to NOOP | diff --git a/kmk/handlers/stock.py b/kmk/handlers/stock.py index 9345c8b..89bdc33 100644 --- a/kmk/handlers/stock.py +++ b/kmk/handlers/stock.py @@ -137,3 +137,10 @@ def ble_disconnect(key, keyboard, *args, **kwargs): keyboard._hid_helper.clear_bonds() return keyboard + + +def any_pressed(key, keyboard, *args, **kwargs): + from random import randint + + key.code = randint(4, 56) + default_pressed(key, keyboard, *args, **kwargs) diff --git a/kmk/keys.py b/kmk/keys.py index 9bced4f..039d977 100644 --- a/kmk/keys.py +++ b/kmk/keys.py @@ -370,6 +370,7 @@ def maybe_make_firmware_key(candidate: str) -> Optional[Key]: ((('HID_SWITCH', 'HID'), handlers.hid_switch)), ((('RELOAD', 'RLD'), handlers.reload)), ((('RESET',), handlers.reset)), + ((('ANY',), handlers.any_pressed)), ) for names, handler in keys: