Help with updating mousekeys speed

Hi all! I’m a new Model 01 user, new to the world of firmware and custom updates too. I’m trying to figure out how to adjust the mousekeys cursor speed—it starts off super slow and accelerates at a snail’s pace.

I found this article which seems like it could help, but I’m not quite sure how to install the code: https://github.com/keyboardio/Kaleidoscope-MouseKeys

Little help?

Much obliged,
Caleb

1 Like

+1

I successfully sped up the ergodox using a config file but I’m not a wizard with the arduino ide yet if I get time to experiment with it I’ll let you know

  case MACRO_MOUSE_LEFT_FAST:
    if (keyToggledOn(keyState)) {
      MouseKeys.speed = 20;
      MouseKeys.speedDelay = 0;
    }
    kaleidoscope::hid::moveMouse(-1, 0);
    break;
    
  case MACRO_MOUSE_LEFT_MID:
    if (keyToggledOn(keyState)) {
      MouseKeys.speed = 5;
      MouseKeys.speedDelay = 0;
    }
    kaleidoscope::hid::moveMouse(-1, 0);
    break;
    
  case MACRO_MOUSE_LEFT_SLOW:
    if (keyToggledOn(keyState)) {
      MouseKeys.speed = 1;
      MouseKeys.speedDelay = 5;
    }
    kaleidoscope::hid::moveMouse(-1, 0);
    break;

The code above in my .ino file has been the only way I’ve been able to combine simple mouse movements with macro functionality. However, I’m not seeing the speed changes I want. The why is pretty clear: when you use the moveMouse call directly, you lose the speedDelay benefits, as this is built into things like Key_mouseL.

Virtually all of the other mouse macros I’ve seen use modifier keys to apply a speed, and some other key actually triggers the movement. What I’m looking for is a macro that does both. @algernon, apologies for tagging you in this, but I thought you might be able to offer advice on how to achieve this. Thoughts?

FYI, I’ve tried using MACRO, as shown below, but I’m not getting any mouse movement. If I replace mouseL with mouseBtnR, I do get a right click, so it seems to be a problem with mouse movement keys specifically. There must be something I’m not understanding when combining with things like keyToggledOn/keyIsPressed and the D/T functions.

  case MACRO_MOUSE_LEFT_FAST:
    if (keyToggledOn(keyState)) {
      MouseKeys.speed = 2;
      MouseKeys.speedDelay = 0;
      return MACRO(D(mouseBtnR));
    }
    break;
    
  case MACRO_MOUSE_LEFT_MID:
    if (keyToggledOn(keyState)) {
      MouseKeys.speed = 1;
      MouseKeys.speedDelay = 0;
      return MACRO(D(mouseL));
    }
    break;
    
  case MACRO_MOUSE_LEFT_SLOW:
    if (keyToggledOn(keyState)) {
      MouseKeys.speed = 1;
      MouseKeys.speedDelay = 5;
      return MACRO(D(mouseL));
    }
    break;

UPDATE: It didn’t really matter what combination of macro functions I used, nothing worked with mouse movement keys. I settled on using the moveMouse function in macroAction to handle the fast/mid speeds:

  case MACRO_MOUSE_LEFT_FAST:
    kaleidoscope::hid::moveMouse(-4, 0, 0);
    break;
    
  case MACRO_MOUSE_LEFT_MID:
    kaleidoscope::hid::moveMouse(-2, 0, 0);
    break;

…while defining the speeds I wanted for the slowest speed keys and using the normal mouse movement keys:

  MouseKeys.speed = 1;
  MouseKeys.speedDelay = 0;
  MouseKeys.accelSpeed = 0;

  [MOUSE] =  KEYMAP_STACKED
  (___, ___, ___, ___, ___, ___, ___,
   ___, ___, ___, ___, ___, ___, ___,
   ___, ___, ___, ___, ___, ___,
   ___, ___, ___, ___, ___, ___, ___,
   ___, ___, ___, ___,
   ___,

   ___, ___, ___, ___, ___, ___, ___,
   ___, M(MACRO_MOUSE_LEFT_FAST), M(MACRO_MOUSE_DOWN_FAST), M(MACRO_MOUSE_UP_FAST), M(MACRO_MOUSE_RIGHT_FAST), Key_mouseScrollUp, ___,
        M(MACRO_MOUSE_LEFT_MID), M(MACRO_MOUSE_DOWN_MID), M(MACRO_MOUSE_UP_MID), M(MACRO_MOUSE_RIGHT_MID), Key_mouseScrollDn, ___,
   ___, Key_mouseL, Key_mouseDn, Key_mouseUp, Key_mouseR, Key_mouseScrollL, Key_mouseScrollR,
   ___, ___, Key_mouseBtnR, Key_mouseBtnL,
   Key_mouseBtnM)

Because I access this new MOUSE layer through the combination of buttons I use to get NUMPAD and FUNCTION layers, I have stumbled upon what seems to be an interesting bug: if I hold the function modifier before I hold the numpad modifier, the mouse keys go faster (about twice as much) than if I hold in the opposite order. This bug seems to also affect normal mouse movement keys like Key_mouseL.

Inspired by this thread, I came up with a macro (that I’m still fine tuning):

case SPEED_UP_MOUSE:
  if (keyIsPressed(keyState)) {
    MouseKeys.speed = 5;
    MouseKeys.accelSpeed = 1;
  } else if (keyToggledOff(keyState)) {
    MouseKeys.accelSpeed = 4;
    MouseKeys.speed = 1;
  }
break;

And then my Shift key on the layer with the mouse keys is set to M(SPEED_UP_MOUSE)

(Whatever is in the keyToggledOff block would be how things end up being by default, so it’s probably a good idea to set a constant and assign the values inside setup() just to be consistent at keyboard startup.)