In QMK there is the feature of an repeat key. When pressed, it repeats the last letter pressed.
This is said to be useful to avoid double presses. E.g. in “foo” you would not double press the “o”, instead press “o” followed by the repeat key. I would like to play with this, if I find it useful.
No, the ask is for something which repeats the last keypress. So if I have to type “too”, I would type t, o, repeat.
It would just have to repeat at usb level I suspect, not the last macro if the user pressed that. I have had the same thought before. The idea is to avoid the slowdown of having to release the key entirely to press again.
I didn’t pursue this before because I thought it would be too much of a mind-bender to use, but now I’m not so sure anymore. Another option I just thought of would be to have a “doubletap mod”. Keys pressed while holding are duplicated. Or as a one-shot pre-press. This might be doable in macros with the current features.
It’s not necessarily easy. Here are some things to consider, just what I can think of right now. Some things are probably non-issues, but not all.
At what level should the repeat happen? Last output character at the USB level, or last keypress at the key level?
If it’s at the key level, I guess it should repeat the same hold time and other considerations. What if the key had a macro whose behavior depended on other things like time or number of repeats? That should be repeated as well, theoretically.
How should one-shot modifiers be treated on repeat presses?
If it’s at USB level, should it repeat with or without mods? That is to say, if I press shift, tap a, release shift, tap repeat. What should repeat output? What if I tap a, tap ctrl, tap repeat? Should that be an a or a ctrl. I’m pretty sure the user might expect a although logically it would be a ctrl.
The simplest and most straightforward, and probably good enough method is of course what @kareltucek suggests: Turn the key into a clone of the last pressed key, so it just runs macros again, letting them play out according to the conditions around that second key press, but then suggestions and requests similar to what I mentioned above would inevitably arise.
Just for fun, I whipped this macro up over lunch: It’s a secondary key with mod effect of doubling any keypresses while it’s active. I tried a typing test, and it might actually be worth learning how to use. If you don’t want the secondary key aspect, just copy the secondary role part and use it alone.
So I guess the repeat key would resolve to a macro that executes activateKeyPostponed $lastKeyId, where $lastKeyId is the key that was pressed before $thisKeyId.