I have started using Callum style layout as I have not managed to make tap-hold to work on my Ferris Sweep consistently. I instantly feel in love with Callum style but soon I have figured out that I need one shot layers as well.
Why Callum style layout is good is well explained in by Callum himself here: https://github.com/callum-oakley/qmk_firmware/tree/master/users/callum
Initially I wanted oneshot layers because sometimes I wanted to do
only one command in that layer. E.g. I have TMUX layer where I
have command to select nearest URL string. So I need to hold NAV
layer, then hold TMUX layer (I can release NAV layer key here if I
want to but can’t release TMUX one) and then I should click letter
u location to select URL. It would be much more fun if I could
simply tap TMUX layer key.
I have tried to implement this without using Callum code but QMK code for oneshot is not tested thoroughly for scenarios like that. E.g. if example above if NAV layer is simple layer key and TMUX is oneshot layer then TMUX is not working at all. If both are one shot layers then one shot behaviour works properly but when layer keys are held they are not working properly. That was frustrating. I have tried to look if I can fix anything there in QMK code but without tests I am not going to touch it as I am too afraid to break something.
So I have decided to implement oneshot layers in the same way Callum style layout is implemented. It was more complicated than I have expected but you can look at the code here:
- one shot implementation.
- one shot header file.
- here you can see how to use one shot layers.
NOTE: dprintf lines can be safely removed from my code as they are there for debugging purposes only.
That actually opens even more possibilities. E.g. you can map same thumb key after switching layer and make it different if you click key once or twice (BTW it is different from tap-dance as you can click twice as slow as you want). E.g you can have numbers layers on thumb and in numbers layer use that thumb for one shot shift. So triple thumb click and 3 will produce # - double click on thumb key activates one shot shift and one more thumb click activates number layer so shift + 3 is #.
I am sharing this in hope that we will see more creative ways what can be done with that.
P.S. My code contains fix for Callum style one shot modifiers as well. If you use one shot mod and press down two or more keys without releasing them then modifier is applied to all of them. E.g. press shift, release shift (triggers one shot shift), press s, press a, release s, release a, will result in “SA” while expectation is “Sa”. That’s especially noticeable when you are typing fast.
UPDATE 2022-08-02: There is better implementation for Callum layout covered with unit-tests in this PR https://github.com/qmk/qmk_firmware/pull/16174