# Easy Keymap switcher

**URL:** <https://community.keyboard.io/t/easy-keymap-switcher/1235>\
**Category:** Programming\
**Tags:** question\
**Created:** [March 10, 2018, 11:44pm UTC](https://community.keyboard.io/t/easy-keymap-switcher/1235 "2018-03-10T23:44:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![esden](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/esden/32/30_2.png) [@esden](https://community.keyboard.io/u/esden)\
**Post date:** [March 10, 2018, 11:44pm UTC](https://community.keyboard.io/t/easy-keymap-switcher/1235/1 "2018-03-10T23:44:50Z")

</div>

Are there any plans/effort to create a way for easy keymap switching? (I did search the forum but have not found anything regarding this topic)

Some background: I use the dvorak layout on my keyboard, but also on regular basis I have someone else use my computer that is not a dvorak user. In the past using a classic keyboard I was just selecting the keyboard mapping in the OS selector (OS X, Windows, Linux I use all of them). Using that solution on the Model 01 is not optimal as I end up with a bunch of special characters hidden under the palm key overlay, when using dvorak.

I would be happy with either of the two following solutions:

- a dedicated program that with one or two clicks can swap the layout programming of the keyboard
- a key combination on the keyboard to switch between two different keyboard mappings within kaleidoscope

Is anyone working on any of those solutions?

Let me know your thoughts.

Cheers,  
Piotr

---

<div class="post-metadata">

**Author:** ![merlin](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/merlin/32/3416_2.png) [@merlin](https://community.keyboard.io/u/merlin)\
**Post date:** [March 11, 2018, 12:25am UTC](https://community.keyboard.io/t/easy-keymap-switcher/1235/2 "2018-03-11T00:25:05Z")

</div>

This is actually quite easy and straightforward to do with Kaleidoscope. The default firmware sketch from the factory has only three keymap layers, but you can define many more than that if you want (up to 32, but the practical limit is space in program memory). I makes a lot of sense for a Dvorak user to also have a QWERTY layer for other occasional users, and switching between them is pretty easy using a `LockLayer` key. I’d be surprised if nobody has done exactly this yet.

---

<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:** [March 11, 2018, 6:35am UTC](https://community.keyboard.io/t/easy-keymap-switcher/1235/3 "2018-03-11T06:35:43Z")

</div>

> [@esden](#):
>
> a dedicated program that with one or two clicks can swap the layout programming of the keyboard

My hope is that eventually, Chrysalis will be able to do this.

> [@esden](#):
>
> a key combination on the keyboard to switch between two different keyboard mappings within kaleidoscope

The MagicCombo plugin and an extra layer or two can achieve this. 🙂

---

<div class="post-metadata">

**Author:** ![james.nvc](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/james.nvc/32/54_2.png) [@james.nvc](https://community.keyboard.io/u/james.nvc)\
**Post date:** [March 11, 2018, 3:15pm UTC](https://community.keyboard.io/t/easy-keymap-switcher/1235/4 "2018-03-11T15:15:03Z")

</div>

I did just this with a leader key combination.

See my [sketch here](https://bitbucket.org/jamesnvc/keyboardiolayout/src/d9584932d54de94dca8473bf040d902a5cc1bdc0/james_layout.ino?at=master&fileviewer=file-view-default#james_layout.ino-230); I defined another layer (`_QWERTY`), then configured the [Leader plugin](http://github.com/keyboardio/Kaleidoscope-Leader) so I can press the `Lead(0)` key (which I have on the `Any` key), then `L` (for layout) then either `Q` for QWERTY or `D` for Dvorak.

---

<div class="post-metadata">

**Author:** ![sirmarksalot](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@sirmarksalot](https://community.keyboard.io/u/sirmarksalot)\
**Post date:** [March 14, 2018, 3:50am UTC](https://community.keyboard.io/t/easy-keymap-switcher/1235/5 "2018-03-14T03:50:11Z")

</div>

> [@merlin](#):
>
> I makes a lot of sense for a Dvorak user to also have a QWERTY layer for other occasional users, and switching between them is pretty easy using a LockLayer key. I’d be surprised if nobody has done exactly this yet.

This is what I ended up doing with mine, but there are a few limitations with that approach. I set the butterfly key to switch between the two, but I do find myself accidentally hitting it from time to time. Ideally, I’d want a key combination, or something on the Function layer to handle this, but I found when I tried to do this it was impossible to get back to the original layer after switching.

The way other LockLayers work, like NumLock, for example, is by having the key fall through on the locked layer, at which point Kaleidoscope finds the original LockLayer and undoes it. For one reason or another, if the original LockLayer is on the Function layer, pressing the same key again will not find it on the stack, so it won’t be reverted, and you’ll be stuck.

Anyway, the unmodified butterfly key seems to work well enough, but it really would be nice to have a more robust solution. As it stands, it’s impossible to scale this to three or more layouts, since the fallthrough logic will just find the last LockLayer. It’s just a hack for switching between QWERTY and Dvorak.

---

<div class="post-metadata">

**Author:** ![merlin](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/merlin/32/3416_2.png) [@merlin](https://community.keyboard.io/u/merlin)\
**Post date:** [March 14, 2018, 4:05am UTC](https://community.keyboard.io/t/easy-keymap-switcher/1235/6 "2018-03-14T04:05:32Z")

</div>

You can avoid the problem of getting a layer stuck by having a `LockLayer(DVORAK)` key on the `QWERTY` (base) layer, and the same key defined as `LockLayer(DVORAK)` on the `DVORAK` layer. The name `LockLayer()` is a bit misleading; it actually causes the target layer to be toggled, so it’s turned on if it was off, and off if it was on. You don’t need to rely on transparent keys and other layers to be able to turn off a “locked” layer – in fact, I would recommend having a `LockLayer(N)` key on any layer that can be activated by a `LockLayer(N)` key from a different layer.

This gives me an idea. @algernon, what do you think of the idea of a layer-switch `Key` value that’s reserved for “unlock _this_ layer”, which does a lookup of whatever layer that key is mapped from, and turns it off?

---

<div class="post-metadata">

**Author:** ![sirmarksalot](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@sirmarksalot](https://community.keyboard.io/u/sirmarksalot)\
**Post date:** [March 14, 2018, 5:18am UTC](https://community.keyboard.io/t/easy-keymap-switcher/1235/7 "2018-03-14T05:18:27Z")

</div>

> [@merlin](#):
>
> You can avoid the problem of getting a layer stuck by having a LockLayer(DVORAK) key on the QWERTY (base) layer, and the same key defined as LockLayer(DVORAK) on the DVORAK layer. The name LockLayer() is a bit misleading; it actually causes the target layer to be toggled, so it’s turned on if it was off, and off if it was on.

Interesting, so if I had four layers:  
DVORAK, FUNCTION\_DVORAK, QWERTY, and FUNCTION\_QWERTY

And then on FUNCTION\_DVORAK I had the butterfly key bound to LockLayer(QWERTY), and on FUNCTION\_QWERTY I had the same key bound to LockLayer(QWERTY), then when I hit Fn+BF the second time, when I released Fn, it would pop the FUNCTION\_QWERTY layer, see that QWERTY was disabled, and then fall through to DVORAK?

Anyway, I’ll give it a shot.

Edit: It worked!
