Help me set up layer switching how I want

So I have “red” and “green” function keys.

Each other key has four characters associated with it: white, red, green, blue

This is the behavior I want:

If Red is pressed once, and no other function keys are pressed, next keypress is the red character, everything else is the white character.
If Red is pressed twice, and no other function keys are pressed, everything after that is the red character. Then if the Red key is pressed again, everything else is the white character.

If Green is pressed once, and no other function keys are pressed, next keypress is the green character, everything else is the white character.
If Green is pressed twice, and no other function keys are pressed, everything after that is the green character. Then if the Green key is pressed again, everything else is the white character.

If either function key is pressed once, and then the other is pressed once, and no other function keys are pressed, the next character is the blue one, and everything after that is the white character.

If a function key is pressed twice in a row, and then optionally some characters are typed, and then the other function key is pressed once, and no other function keys are pressed, all characters after that are the blue ones. Then if any function key is pressed, everything after that is the white character.

Is there a simple way of doing this or something like this? I keep getting in weird states where neither function key works.

(It doesn’t have to be exactly this - I just need some easy way of getting in or out of the seven different states: normal, red lock, green lock, blue lock, red one-shot, green one-shot, blue one-shot)

You should be able to get most of what you want, but there’s a bug in the current version of OneShot that will get in the way. To get the last little bit, you’d need a custom plugin.

[Explanation coming shortly]

1 Like

Ok, how do I get most of it?

So, I assume you’ve already discovered OneShot layers, which are supposed to do what you want (except the last little bit, which probably isn’t worth it). I’ll assume the layers are as follows, from bottom to top:

  • 0: WHITE
  • 1: RED
  • 2: GREEN
  • 3: BLUE

I’ll call the two “function” keys red and green.

Mapping for red on each layer:

  • WHITE => OSL(RED)
  • RED => Key_Transparent
  • GREEN => OSL(BLUE)
  • BLUE => Key_Transparent

Mapping for green on each layer:

  • WHITE => OSL(GREEN)
  • RED => OSL(BLUE)
  • GREEN => Key_Transparent
  • BLUE => Key_Transparent

This should work (except that you would always need to double-tap the second “function” key to lock the BLUE layer active), but it won’t, because of the aforementioned bug.

The problem is that, with the current version of OneShot, double-tapping green won’t lock the GREEN layer, because as soon as you release the key, it will be mapped to OSL(BLUE) instead of staying as OSL(GREEN). The good news is that there is a PR open against Kaleidoscope right now that would fix this (#905). If you’re comfortable with checking out a git branch and building your own firmware, you can try it out, and get the vast majority of what you want.

2 Likes

I tried something like that and ended up stuck locked on the Blue layer. How does getting out of the Blue layer work with that?

Oh, right. That’s also a problem with the current version of OneShot, but will work the way you want if #905 gets merged.

Thanks for all your help here (and I’m famous now!)

Can you elaborate on the other problem with the current OneShot and the changed behavior in #905?

OneShot is, in essence, emulating the user holding down a key after the key is released. Unfortunately, the current version of OneShot does this by emulating the key value being active, not the key position. This means that if you hold one of your red or green OSL keys, then the other one, then let go of the first one, you won’t have any keys that map to OSL(BLUE), which is what you need to press to cancel the “sticky” blue layer.

With PR #905, OneShot will emulate the key at a certain position being held, and therefore its value will remain active as a OneShot layer that, when tapped again, will deactivate the target layer, preventing that layer getting “stuck”.

2 Likes