# Activate a different Layer when both function keys are depressed

**URL:** <https://community.keyboard.io/t/activate-a-different-layer-when-both-function-keys-are-depressed/1746>\
**Category:** Programming\
**Created:** [July 8, 2018, 3:39pm UTC](https://community.keyboard.io/t/activate-a-different-layer-when-both-function-keys-are-depressed/1746 "2018-07-08T15:39:05Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![rumpel](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/rumpel/32/626_2.png) [@rumpel](https://community.keyboard.io/u/rumpel)\
**Post date:** [July 9, 2018, 11:34am UTC](https://community.keyboard.io/t/activate-a-different-layer-when-both-function-keys-are-depressed/1746/6 "2018-07-09T11:34:24Z")

</div>

> [@algernon](#):
>
> 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.

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 {
         SwitchToLayerLFNandRFN
};

void switchToLayerLFNandRFN(uint8_t combo_index) {
  ShiftToLayer(LFNandRFN);
}

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

```

---

_[View the full topic](https://community.keyboard.io/t/activate-a-different-layer-when-both-function-keys-are-depressed/1746)._
