tmk_keyboard
tmk_keyboard copied to clipboard
Adds oneshot layer and oneshot tap toggling
- Adds ACTION_LAYER_ONESHOT
- Adds ONESHOT_TAP_TOGGLE
- Mentions sticky keys in the docs on oneshot.
- Removes the duplicate documentation folder tmk_core/doc
I tried ACTION_LAYER_ONESHOT from this branch and could not get it to work. As far as I can tell, it is mis-named. What it actually does is like "sticky keys", where you have to tap N number of times to toggle on, then tap again to toggle off. That is not the same as ONESHOT. ONESHOT is where you just tap once, and then the next key (and only the next key) is affected by the layer/mod. I think this should be called ACTION_LAYER_TAP_TOGGLE to be consistent with existing naming.
I have no idea what ONESHOT_TAP_TOGGLE does or what it should do, by the name. ONESHOT, TAP, and TOGGLE are three different functions and I can't figure out how one key can do all three. What does that one do?
There are two different ways you can use ACTION_LAYER_ONESHOT, depending on what ONESHOT_TAP_TOGGLE is set to.
- If ONESHOT_TAP_TOGGLE is left undefined, then a ACTION_LAYER_ONESHOT should behave the same as the tmk ACTION_MODS_ONESHOT key, except of course it works on a custom layer instead of a modifier key.
- If ONESHOT_TAP_TOGGLE=X is defined, a ONESHOT key (i.e. ACTION_LAYER_ONESHOT or ACTION_MODS_ONESHOT ) will behave as above except if it is tapped X times in a row, then it will toggle to the layer instead. The layer can then be untoggled by a single tap of the corresponding ONESHOT key.
For example, define ONESHOT_TAP_TOGGLE=3 and let L1 be a layer key with L1=ACTION_LAYER_ONESHOT(1) and on the layer L1 the key a maps to 1. Then you should see this behaviour:
<L1-Pressed> <L1-Released> <a><a><a>=>1aa<L1-Pressed> <a><a><L1-Released> <a>=>11a<L1><L1><L1> <a><a><a> <L1> <a>=>111a
@ahtn, your explanation makes sense to me now. I'll look into your code to merge.
Can you remove change on doc from this pull request? This is not relate to oneshot function logically, I'd like smaller, more atomic to the point pull request.
* Removes the duplicate documentation folder tmk_core/doc
Never mind. I'll remove it myself. Thanks.
Hey @tmk : What's the status of this feature? Is there a reason it hasn't been merged yet?
I have to test this function and rebase then. I'll do it later (tm) :D