TapDance getting stuck?

I am using the TapDance plugin to modify the behavior of my Control keys. Left Control, when double-tapped, sends LGUI+[; Right Control sends LGUI+] when double-tapped.

void tapDanceAction(uint8_t tap_dance_index, byte row, byte col,
                    uint8_t tap_count,
                    kaleidoscope::plugin::TapDance::ActionType tap_dance_action) {
  switch (tap_dance_index) {
  // 1. Left control
  // 2. Shift+[
  case BACK:
    return tapDanceActionKeys(tap_count, tap_dance_action, Key_LeftControl,
                              LGUI(Key_LeftBracket));
  // 1. Right control
  // 2. Shift+]
  case FORWARD:
    return tapDanceActionKeys(tap_count, tap_dance_action, Key_RightControl,
                              LGUI(Key_RightBracket));
  }
}

(BACK and FORWARD are defined earlier in an anonymous enum.)

However, I’m encountering strange behavior. While double-tapping either Control produces the correct key combination, rapid use of a Control chord (such as Control+Tab gets that Control key “stuck” in the TapDance action. A concrete example:

  1. Control+Tab to change browser tabs
  2. Release Tab, then Control
  3. Control+Tab to change browser tabs again

#3 should have the same behavior as #1; however, the key combo sent to my system is actually LGUI+Tab (more likely LGUI+[+Tab, with the [ being ignored), which results in bringing up the Mac’s task switcher.

Is there something I’m doing wrong? I don’t have any special settings configured for TapDance other than tapDanceAction().

It’s very much possible that the TapDance plugin is bugged. It’s a complicated piece of code, sometimes for no good reason. It really needs a careful refactor.

Your code appears correct, too. Can you file an issue on GitHub? Easier for me to track & schedule that way. Thanks!

1 Like

Any news on the TapDance? This is such a necessary plugin, but too buggy - I even still use the QMK instead of the Kaleidoscope only by this reason.
Cheers.

@tiltowaitt: Looking at your code above, it seems like you might want to try using Qukeys instead of TapDance to achieve a fairly equivalent result. It would mean a single tap instead of a double tap to get the alternate key value, but otherwise the same behaviour you want, without any bugs from TapDance.

1 Like

I never considered using Qukeys for this. I actually wound up writing my own plugin to do it.

1 Like