Has anyone modified the oneshot plugin to ignore spaces? By this I mean instead of outputting e.g. shift+space, the space key would be passed through normally while oneshot stays active, until I press any other key like a letter.
I wanted to modify OneShot to include another time out period that would cause the keyboard layout to return to the standard one after a long time (preferably something that we could set from on the .ino file).
My logic: I have the keyboard layout change on OneShot, but sometimes I walk away from the machine, and forget to check the layout. For the moment, I have made changes to some other module that forces the layout back to the standard one, but it does not clear the OneShot from the Fn Button I use to trigger the layout (one click: one shot layout change, two clicks for permanent layout change).
It works more or less ok, except that you need to check the color on the button. If the button still has a color indicating that the layout is active, the first press will remove that, but not really activate one-shot for the layout. The second press will activate one-shot, and a third press activate the layout. This is not really what I had in mind, but I could not figure out yet how to add another timeout to the One Shot module.
Next step would be to have this only apply to my OSM for LeftShift, as I only need it there so I don’t have to slow down when capitalizing words.
I managed to make this change in ~/.arduino15/packages/keyboardio/hardware/avr/1.98-beta/libraries/Kaleidoscope/src/kaleidoscope/plugin/OneShot.cpp after following https://kaleidoscope.readthedocs.io/en/latest/setup_toolchain.html to setup the Arduino IDE. When uploading the firmware from the IDE, it will end up building from these sources. Surprisingly, it didn’t overwrite the layout I had configured in Chrysalis!
Are you on the latest experimental (the one that includes plugins) firmware from Chrysalis?
I think it provides what you want. If I use OneShot fn (the palm key) and wait a few seconds, it will automatically deactivate and the next keypress will apply to the default layer.
My problem is slightly different: I press the palm key twice, so it changes the layout for all future keys.
Then, for some reason or another, I am pulled away from the keyboard, and when I come back to the computer, I forget to look at the colors of the keys (I am using functional colors)
I was able to put a timeout that switches the keyboard layout to the default after 10 minutes of inactivity, but the OneShot still has the status set to the other layout, even though the layout itself is the primary.
So, the issue I have is this: the palm key still shows red (indicating that the OneShot thinks that it is active), but the layout is back to the primary. When I press the palm key once after that, it cancels the OneShot. The second click on the same key activates the one-shot for the new layer, but after the first key, it goes back to the primary layer (which is what OneShot means). So you need to do three taps to put it locked on the new layer, but only if you timed out on the second layer.
What I would like to happen is for the layer locking to timeout and revert all keys to the primary mode (including modes like shift, control, and so on) so that if you walk away from the keyboard for an extended (configurable) amount of time, you know that it will be back to a default mode.
Sorry for the confusing description. Let me know if I am not the only one that needs something like that. Ideally, we would like to have an extra parameter, so if that is set to 0, there would not be a timeout, and the keyboard stays in the modified layer for anybody that thinks this is too complex. If you set to a value larger than the SingleShot timeout, that would be how long you have between key presses before the layout reverts. Not sure what would be correct syntax if you set the double-
Beware that with some layout [Space] and [Shift]+[Space] are not the same character (eg. with BÉPO shifted space give an unbreakable space), so make change in the core of OSM may add some strange behaviors for others
I think I see what you mean now. You want a timeout for stickability. It’s configuration should probably be similar to .time_out just called .stickability_time_out instead, and like you say, it would default to 0 for the current behaviour but any greater value would specify the timeout in ms.
Don’t worry! I won’t attempt to upstream my changes, as I know it’s very specific. I’m still thinking about how to make it configurable through plugin properties since I know it’s something other speed-typists using oneshot for shift will bump into. I have come up with one approach using arrays, but my C++ fu is not good enough to do this in a way compatible with the constraints of Kaleidoscope.
Here you go, I hope it solves your problem. Configure it by adding OneShot.sticky_time_out = 4000; to your setup() (I decided to call it sticky instead of stickability as the latter wasn’t previously used in the code). Let me know if you need any help. I also think this would be useful to others, so it would be great if you could test it for a while (both with sticky_time_out defined and not defined) to see there are no bugs. Once you think it’s good I’ll PR it.
It worked almost perfectly. Only one small issue: I had to change the stick_time_out from uint16_t to uint_32t (I wanted something around 5 to 10 minutes, but 16 bits would only let me go to 65.535 seconds).
I also had to translate it to the older version of Kaleidoscope I am using (nothing too bad, but I still do not know if I can get ActiveModColor and FunctionalColor to run together with the other stuff I have on the newer version), but nothing too complicated.
I am running more tests soon with the sticky_time_out not defined to be sure it works without breaking anything for anyone else.
Thanks for the help.
@lgnakano — What are you using to reset the keymap (active layers)? It would probably be much simpler to just call kaleidoscope::plugin::OneShot.cancel() along with whatever calls are resetting the active layer(s).
I think I see what you mean now. you would like a timeout for stackability. Its configuration should probably be almost like .time_out just called .stickability_time_out instead, and such as you say, it might default to 0 for the present behavior but any greater value would specify the timeout in ms.