Activate a different Layer when both function keys are depressed


Is it possible to toggle a new layer based on both function keys being depressed? (prefably which still allows the use of oneshot at all layers, where either function activates a different layer)

I was thinking I could define two distinct layers for left and right function and within those layers if the alternate function key was depressed I would activate the 3rd layer.

I would prefer not to have different layers activated when either function is pressed, but rather either goes to layer 2, and both go to layer 3.

Looking for a bit of inspiration before I attempt to do it in the least elegant way.

(Gergely Nagy) #2

Lets say you have four layers, Base, L1, L2 and L3. On the Base layer, assign OSL(L1) to the left palm key, OSL(L2) to the right. On L1, assign OSL(L3) to the right one, and on L2, OSL(L3) to the left one. This should work.

It may not work right now, but it should, and I’ll get around to fixing whatever bug is causing it not to work. Mind you, the bug I see is from a little more complicated setup, so might not apply to this simple case.

Another option is to use MagicCombo, and have it do the switching to L3.


I will look at the Magic Combo option as my requirement is to avoid having two identical layers for layers 2,3.

My goal for the time being is a 3 layer setup:

On Base if I press either palm function key I want to go to L1, if I press both its L2.

Thanks for the suggestion, I will take a look at it now!

(Gergely Nagy) #4

In that case, you should be able to make the palm key OSL(L2) on L1.


Thanks (again)

I had a quick look at magiccombos and I think that might be an easier way to go, most of my layer3 options are going to be macros for specific things, Ctrl-Alt-Delete and tmux motion commands/vim motion commands.

I will try it both ways and see which works better.


Your solution does work, and it’s the one I currently use, but it has one annoying side effect: If you get to L3 by pressing L1 and L2 (no matter in what order), you cannot get out of L3 unless you release both FN/layer keys. So if you want to get back from L3 to, say, L1 by releasing the right FN key, you still remain in L3.

@nevd I think MagicCombo does not have this problem. I’ll have to try it too.

Edit: MagicCombo works nicely. It solved the problem of getting stuck in a layer as mentioned above. Here’s the code I’m using:

enum MC {

void switchToLayerLFNandRFN(uint8_t combo_index) {

[MC::SwitchToLayerLFNandRFN] = {
  .action = switchToLayerLFNandRFN,
  .keys = {R3C6, R3C9} // Left Fn + Right Fn


I cannot seem to make Magic Combo activate a layer.

I ended up using the KindOfMagic from MagicCombos to prove to myself the Plugin was working at all.

When I did this I noticed something that would be unwanted. Both the string and the 2nd layer function of mouse movement occurred at the same time! I assume that is not occurring when you switch to a layer.

My 3 lines of code at this point look like this


void stl_DoubleFunk(uint8_t combo_index) { ShiftToLayer(DOUBLE_FUNK); }

USE_MAGIC_COMBOS([STL_DOUBLEFUNK] = {.action = stl_DoubleFunk, .keys = {R3C6, R3C9}});

Any chance I could get some assistance?

(Gergely Nagy) #8

This is the issue: ShiftToLayer is a markup only useful in the keymap. It translates to a keycode, and that’s about it. The above code is essentially this:

void stl_DoubleFunk(uint8_t combo_index) { 

…and this isn’t exactly useful in this context. You’ll need to use the Layer.on()/ functions directly:

void stl_DoubleFunk(uint8_t combo_index) {
  if (Layer.isOn(DOUBLE_FUNK)) {;
  } else {

Mind you, you can only toggle layers with MagicCombo, you can’t do momentary layers as with ShiftToLayer, due to technical reasons. If that’s what you want, we’ll have to find another solution :confused: