TapDance getting stuck?


(tiltowaitt) #1

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().


(Gergely Nagy) #2

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!