Double click for CapsLock?

I occasionally use caps lock, and so I thought it’d be nice to toggle it via OneShot. This works:

OSM(LeftShift)…OSM(RightShift)
and I also use ActiveModColor along side it

but it’s not exactly what I want. If I double click on either shift it does the OneShot+mod color thing just fine, but it also ‘capitalizes’ non-alphabetic characters (, . / - and the numerics). Is there a way to set it up so that a double click of shift leaves me in caps lock just like in OneShot, but only for a-z?

Do you want to use Shift in a one-shot mode? Or were you trying one-shot only for the dobule-tap locking behaviour?

If the latter, then TapDance can help, and I’ll happily provide an example. If the former… that’s a bit harder to accomplish, as there is no ready-made solution just yet (but I guess a combination of tap-dance and oneshot could work…)

I like OneShot for other things, but specific to caps lock I was only using shift+OneShot for double tap locking behavior, at least so far. If you can provide an example that’d be great. Thanks!

eric

void tapDanceAction(uint8_t tapDanceIndex, byte row, byte col, 
                    uint8_t tapCount, 
                    kaleidoscope::TapDance::ActionType tapDanceAction) {

  switch (tapDanceIndex) {
  case SHIFT_CAPS: 
    {
      static bool isCapsOn;

      if (tapDanceAction == kaleidoscope::TapDance::Release) {
        Macros.play(MACRO(T(CapsLock)));

        if (isCapsOn) {
          isCapsOn = false;
          return;
        }
        isCapsOn = true;
      }

      return tapDanceActionKeys(tapCount, tapDanceAction,
                                Key_LeftShift, Key_CapsLock);
    }
  }
}

When you press this once and hold it, it will act as a LeftShift. Tap it twice, and it will become CapsLock. To make it possible to turn Caps Lock off with a single tap, we remember if it turned on, and regardless of tapCount, turn it off if it was on.

Mind you, this is untested, you may have to adjust it a little.

1 Like

This is where I plug my plugin, which does light up the keys, but which is triggered by a press of Key_CapsLock instead of a double tap of a shift key. It may or may not be close enough to the functionality you want. I’m not sure how it would behave if you used TapDance to send the Key_CapsLock event instead of binding it somewhere in your keymap, but if you try it and it works in combination with TapDance report back!

I’m finally getting around to trying this.

Newbie Arduino question: I’m on Windows, where do I put your code once I download it from Github? I see C:\Program Files (x86)\Arduino\examples\ but don’t see a keyboardio directory anywhere obvious. Do I put something in ‘additional board manager urls’?

eric

It goes under Arduino/keyboardio/hardware/avr/libraries, which is a directory that will be created when you follow the Kaleidoscope build instructions. I’m also new at Arduino, so I don’t know how the “additional board manager urls” configuration would work.