# Tap or hold layer switch

**URL:** <https://community.keyboard.io/t/tap-or-hold-layer-switch/4203>\
**Category:** Programming\
**Created:** [October 9, 2020, 8:05am UTC](https://community.keyboard.io/t/tap-or-hold-layer-switch/4203 "2020-10-09T08:05:06Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zindar](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/zindar/32/3470_2.png) [@Zindar](https://community.keyboard.io/u/Zindar)\
**Post date:** [October 9, 2020, 8:05am UTC](https://community.keyboard.io/t/tap-or-hold-layer-switch/4203/1 "2020-10-09T08:05:06Z")

</div>

Hi

I’m trying to make it so that if I hold down the fun key, it shifts to the layer until I let go, just like “shift to layer” does today, but if I tap it, it should lock the layer, like “Lock layer to” does. Is this doable?

---

<div class="post-metadata">

**Author:** ![ewosborne](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/ewosborne/32/1286_2.png) [@ewosborne](https://community.keyboard.io/u/ewosborne)\
**Post date:** [October 9, 2020, 1:33pm UTC](https://community.keyboard.io/t/tap-or-hold-layer-switch/4203/2 "2020-10-09T13:33:32Z")

</div>

I can get close with OneShot. I have Fun set to OSL(Layer1). This chords Layer1 if I hold it down, but shifts to Layer1 if I double click. A single click returns it to Layer0.

---

<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:** [October 9, 2020, 1:51pm UTC](https://community.keyboard.io/t/tap-or-hold-layer-switch/4203/3 "2020-10-09T13:51:23Z")

</div>

You can do this with Qukeys, but not via Chrysalis. If you map the key to `LockLayer(FUN)` in the keymap, but define that key as a Qukey that becomes `ShiftToLayer(FUN)` when held, it will do what you want.

The OneShot solution takes two taps to “lock” the layer, and currently fails if that key is mapped to something else on the target layer (there’s a PR open that will fix this), but I would nevertheless recommend that solution over the Qukeys trick in general.

---

<div class="post-metadata">

**Author:** ![Zindar](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/zindar/32/3470_2.png) [@Zindar](https://community.keyboard.io/u/Zindar)\
**Post date:** [October 9, 2020, 2:08pm UTC](https://community.keyboard.io/t/tap-or-hold-layer-switch/4203/4 "2020-10-09T14:08:06Z")

</div>

How would the one shot solution work? I tried to do OSL 1 on layer 0, then LockTo 1 on the same button on layer 1, but unfortunately it doesn’t lock.

---

<div class="post-metadata">

**Author:** ![Zindar](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/zindar/32/3470_2.png) [@Zindar](https://community.keyboard.io/u/Zindar)\
**Post date:** [October 9, 2020, 2:09pm UTC](https://community.keyboard.io/t/tap-or-hold-layer-switch/4203/5 "2020-10-09T14:09:28Z")

</div>

Answering my own question, leaving the button as transparent on layer 1 works. Thanks, this is perfect for me!

---

<div class="post-metadata">

**Author:** ![fire](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@fire](https://community.keyboard.io/u/fire)\
**Post date:** [October 9, 2020, 8:55pm UTC](https://community.keyboard.io/t/tap-or-hold-layer-switch/4203/6 "2020-10-09T20:55:17Z")

</div>

So I’m confused. I thought One Shot was a one-shot thing (hence the name) not something that locked the layer. You have to press it twice to lock the layer.

---

<div class="post-metadata">

**Author:** ![fire](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@fire](https://community.keyboard.io/u/fire)\
**Post date:** [October 9, 2020, 8:56pm UTC](https://community.keyboard.io/t/tap-or-hold-layer-switch/4203/7 "2020-10-09T20:56:31Z")

</div>

> [@merlin](#):
>
> I would nevertheless recommend that solution over the Qukeys trick in general.

Why would you recommend that solution over Qukeys?

---

<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:** [October 9, 2020, 9:04pm UTC](https://community.keyboard.io/t/tap-or-hold-layer-switch/4203/8 "2020-10-09T21:04:14Z")

</div>

It’s a single key definition in the keymap, and the plugin that handles it is specifically meant for the task. Qukeys is quite a large plugin, so if you’re not already using it for other things, or it’s very important to need only one tap to lock the layer, I’d go with OneShot. Also, configuring that specific key with Qukeys is more involved (it can’t be done with Chrysalis alone).
