Can't get shifted equal sign to repeat


(Brian Fitzpatrick) #1

tl;dr: I want a [0/=] key: One that types [0] (zero) unshifted and [=] shifted. I can do this with a macro, but the = doesn’t repeat. I can get [0/=] without a repeating =, but anything else I try results in a [0/+]… the [+] repeats, but that’s no good :slight_smile:.

Long details: I’ve been using a Maltron for 20 years and I’m loving my new Keyboardio. I’m 99% done with a Malt layout on my Keyboardio, including the layout I have where the shifted numbers are:

1 +
2 ^
3 #
4 $
5 (
6 )
7 &
8 @
9 %
0 =

Shapeshifter does the trick for most of these keys, but not for [0/=] because I’m not holding down shift to generate the [=] but I am for the rest.

Since I’m holding down shift in this case, no matter what I do, (other than MACRDOWN or PSTR) results in a [+] being sent.

I’ve successfully created a macro to do this with other keys where the shifted value is also shifted on my custom key, like [*/|]:

/** Provide a key that types [*] when not shifted and [|] when shifted. Keys repeat
    correctly when held.
    */
static void starPipeMacro(uint8_t keyState) {
  static Key lastKey;
  bool isShifted = kaleidoscope::hid::wasModifierKeyActive(Key_LeftShift)
         || kaleidoscope::hid::wasModifierKeyActive(Key_RightShift);

  if (keyToggledOn(keyState)) {
    if (isShifted) {
      lastKey.keyCode = Key_Backslash.keyCode;
    }
    else {
      lastKey.keyCode = Key_8.keyCode;
      lastKey.flags = lastKey.flags | SHIFT_HELD;
    }
  }

  if (keyIsPressed(keyState))
    kaleidoscope::hid::pressKey(lastKey);
}

This function makes me happy because I can type both keys and have them repeat appropriately in my OS. Was hoping to do the same with [0/=] but no such luck. I’ve checked and the lastKey.flags doesn’t have the Shift bit set, and releasing both shift keys doesn’t seem to do the trick anywhere.

Halp.


(Michael Richters) #2

I’ve got an incomplete layout with the same fundamental problem (wanting to arbitrarily rearrange the symbols on the keys, including unshifted symbols in shifted positions). I realized some time ago that this was going to be quite difficult to do in Kaleidoscope because of how the key scan is processed (rollover becomes very tricky). I’ve got a plugin design in mind (working title: Unshifter) that should work, but only with my own event-driven fork of Kaleidoscope. I still haven’t implemented it yet, but if you’re interested, I can let you know when I have.

In the meantime, I think it may be possible to solve your immediate problem with a macro, but I’m away from home right now, so I can’t easily test it out. Also, whether or not it will work may depend on the relative positions of the key you have that = on and the shift key(s) you use in combination with it.


(Brian Fitzpatrick) #3

I’m glad to try anything – the zero is where the zero usually is on the keyboard and the [=] is right above the zero if that helps. No rush – the non-repeating [=] isn’t the end of the world…


#4

I’m using a Programmer Dvorak layout, where shift+9 inputs =. To get keys to repeat I stopped using macros and wrote a plugin that takes a layer-based approach: https://github.com/nikitakit/Kaleidoscope-ModifierLayers

This might be overkill for just one key, but I find that it works well for my needs.


(Brian Fitzpatrick) #5

This is definitely overkill but I love it :slight_smile:

If I use this, do my shift keys still work properly with the OS (e.g. shift-clicking)?


#6

Yes, the modifier keys will continue to work for shift-clicking (i.e. they register if pressed by themselves).


(Brian Fitzpatrick) #7

Awesome – will give it a shot tonight!