# Modifier & Shift Layer

**URL:** <https://community.keyboard.io/t/modifier-shift-layer/3505>\
**Category:** Help and Getting Started\
**Tags:** question\
**Created:** [January 17, 2020, 4:24pm UTC](https://community.keyboard.io/t/modifier-shift-layer/3505 "2020-01-17T16:24:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![boris](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@boris](https://community.keyboard.io/u/boris)\
**Post date:** [January 17, 2020, 4:24pm UTC](https://community.keyboard.io/t/modifier-shift-layer/3505/1 "2020-01-17T16:24:14Z")

</div>

What would be the easiest way of making a key activate a modifier (like pressing CTRL) and shifting to another layer at the same time?

I could program the key to shift to another layer where I make every key in that layer being pressed with the modifier (LCTRL(Key\_…)), but that seems quite cumbersome to write and maintain. Is there another way to tackle this problem more elegantly?

---

<div class="post-metadata">

**Author:** ![algernon](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/algernon/32/4404_2.png) [@algernon](https://community.keyboard.io/u/algernon)\
**Post date:** [January 17, 2020, 8:20pm UTC](https://community.keyboard.io/t/modifier-shift-layer/3505/2 "2020-01-17T20:20:49Z")

</div>

> **[jamesnvc/Kaleidoscope-PrefixLayer](https://github.com/jamesnvc/Kaleidoscope-PrefixLayer)**
>
> Prefix every key on a layer with a key sequence. Contribute to jamesnvc/Kaleidoscope-PrefixLayer development by creating an account on GitHub.

😉

---

<div class="post-metadata">

**Author:** ![boris](https://avatars.discourse-cdn.com/v4/letter/b/74df32/32.png) [@boris](https://community.keyboard.io/u/boris)\
**Post date:** [January 20, 2020, 9:41am UTC](https://community.keyboard.io/t/modifier-shift-layer/3505/3 "2020-01-20T09:41:10Z")

</div>

Thanks. That only seems to cover when you want the prefix to be released before the key from the layer. As in CTRL+B X, for tmux, with CTRL+B being the prefix and released before the key X from the layer is being pressed. Very handy, but in my case I want the key from the layer to be prefixed with a key that is remained pressed down, as in CTRL+X, with CTRL being the prefix and being kept pressed down, then the key X from the layer being pressed and afterwards both keys are being released.

---

<div class="post-metadata">

**Author:** ![alanmoo](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/alanmoo/32/2070_2.png) [@alanmoo](https://community.keyboard.io/u/alanmoo)\
**Post date:** [June 21, 2020, 5:19pm UTC](https://community.keyboard.io/t/modifier-shift-layer/3505/4 "2020-06-21T17:19:05Z")

</div>

This might not work for you, but I stumbled across this thread in looking for a solution to my situation and figure it might help others:

I’m running MacOS and wanted to be able to pull up the application switcher with a key other than “tab” on the Model 01 and cycle through applications. I ran into the same problem- I could only switch layers with the key pressed down or trigger the command key press event; not both.

I ended up mapping MagicCombo to the keys I wanted to use instead of creating an entire layer. It works reasonably well, though there’s a moment in which it doesn’t capture repeated presses of the combo.

Relevant code:

```auto
USE_MAGIC_COMBOS({
/* Command+Tab on Command+Command press */
  .action=applicationSwitcher,
  .keys= { R1C7, R2C8 }
},
/* Add in Shift key to reverse it */
{
  .action=applicationSwitcherReverse,
  .keys= { R1C7, R0C7, R2C8 }
});

```

and

```auto
static void applicationSwitcher(uint8_t combo_index) {
      kaleidoscope::hid::pressKey(Key_Tab.keyCode, true);
}
static void applicationSwitcherReverse(uint8_t combo_index) {
      kaleidoscope::hid::pressKey(Key_Tab.keyCode, true);
}

```
