# Disable oneshot stickability for modifiers

**URL:** <https://community.keyboard.io/t/disable-oneshot-stickability-for-modifiers/6037>\
**Category:** Programming\
**Tags:** question, plugin\
**Created:** [December 3, 2022, 6:38pm UTC](https://community.keyboard.io/t/disable-oneshot-stickability-for-modifiers/6037 "2022-12-03T18:38:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![MalarJuggler](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@MalarJuggler](https://community.keyboard.io/u/MalarJuggler)\
**Post date:** [December 3, 2022, 6:38pm UTC](https://community.keyboard.io/t/disable-oneshot-stickability-for-modifiers/6037/1 "2022-12-03T18:38:52Z")

</div>

I added `OneShot.disableStickabilityForModifiers();` at the end of of `setup()` but after flashing the modifier keys are still stickable. The 2nd touch makes the modifier key red, where I would expect it to output the SpaceCadet character at that point. The SpaceCadet character is only output after 3 taps.

I also tried resetting the modifier keys to the default and calling `OneShot.enableAutoModifiers();` but that doesn’t seem to have any effect. In fact, no configuration call to `OneShot` seems to produce any effects.

I even tried removing the `OneShotConfig` plugin, but still no dice. I am flashing the firmware through Chrysalis, btw.

Any ideas?

---

<div class="post-metadata">

**Author:** ![MalarJuggler](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@MalarJuggler](https://community.keyboard.io/u/MalarJuggler)\
**Post date:** [December 3, 2022, 10:44pm UTC](https://community.keyboard.io/t/disable-oneshot-stickability-for-modifiers/6037/2 "2022-12-03T22:44:11Z")

</div>

Oh, I just saw this in the `My Keyboard` section, that explains things:

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/keyboard/original/2X/f/f10410583c0bfd04b0e6e6715e4cf50044165d67.png)

---

<div class="post-metadata">

**Author:** ![MalarJuggler](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@MalarJuggler](https://community.keyboard.io/u/MalarJuggler)\
**Post date:** [December 3, 2022, 11:13pm UTC](https://community.keyboard.io/t/disable-oneshot-stickability-for-modifiers/6037/3 "2022-12-03T23:13:06Z")

</div>

It also turned out to be a conflict with SpaceCadet. Looks like SpaceCadet doesn’t play well with all the options of OneShot.

---

<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:** [December 4, 2022, 5:47am UTC](https://community.keyboard.io/t/disable-oneshot-stickability-for-modifiers/6037/4 "2022-12-04T05:47:39Z")

</div>

This is an unanticipated use case. You’ve got a key mapped to `OSM()`, and you also want to use that key to produce printable characters with SpaceCadet, which strikes me as illogical. Here’s what’s going on:

SpaceCadet processes key events before OneShot (regardless of their relative positions in `KALEIDOSCOPE_INIT_PLUGINS()`), and ignores the first toggle-on of the `OSM` key because it’s not a key that it’s configured to look for. Then OneShot sees that event and changes the `event.key` value to `Key_LeftShift` (for example). The second tap causes SpaceCadet to recognize to delay the processing of the toggle-on event, and then change the `event.key` value to `Key_LeftParen` (assuming that’s what it’s mapped to). But when OneShot sees the event, if it has “sticky” modifiers enabled (I think “sticky” means two different things in Chrysalis and Kaleidoscope, but I’m not sure; I’m referring to the Kaleidoscope terminology here, where a double-tap normally keeps the modifier active indefinitely), OneShot keeps the key active by suppressing the toggle-on event, even if the `event.key` value doesn’t match the current value of the the active key. This behaviour could be changed by adding somewhat to the complexity of OneShot, but I’m not convinced that it really makes any sense to try to combine the two plugins on the same key.

Was your intention to have a single tap act like a one-shot modifier, but a double tap emit a printable character? If so, it would be more natural (and reliable) to combine TapDance with OneShot, rather than SpaceCadet.

---

<div class="post-metadata">

**Author:** ![lgnakano](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/lgnakano/32/2441_2.png) [@lgnakano](https://community.keyboard.io/u/lgnakano)\
**Post date:** [December 4, 2022, 4:39pm UTC](https://community.keyboard.io/t/disable-oneshot-stickability-for-modifiers/6037/5 "2022-12-04T16:39:02Z")

</div>

I am not sure if this was the intent, but I created a macro that I use on my sketch to switch between activating OneShot or SpaceCadet.

There is some code on this thread explaining how I did if this is what you wanted:

> [@How to set the led color for a single key in a macro?](https://community.keyboard.io/t/how-to-set-the-led-color-for-a-single-key-in-a-macro/5962/2):
>
> I found a solution, but I am not sure if this is optimal. I created a new layer that has only one key that is not transparent, and that is the key that I am using to trigger the macro, but on this new layer, it has a different macro, eg: [PRIMARY] = KEYMAP\_STACKED ( ... M(MACRO\_SWITCH\_SPACE\_CADET) ... ), [SECONDARY] = KEYMAP\_STACKED ( ... M(MACRO\_SWITCH\_SPACE\_CADET2) ... ), Both macros trigger the same function: const macro\_t \*macroAction(uint8\_t macro\_id, KeyEvent &event) { switch (macro…

On the same thread, there is a link to the sketch I use in case you want to look at it for inspiration.

Basically, I have one button that switches between the two modes, and the key changes colors as well so I know in which mode I am. I was toggling all of the OneShot functionality, but it would be easy to keep some of the functions active.

---

<div class="post-metadata">

**Author:** ![MalarJuggler](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@MalarJuggler](https://community.keyboard.io/u/MalarJuggler)\
**Post date:** [December 4, 2022, 9:03pm UTC](https://community.keyboard.io/t/disable-oneshot-stickability-for-modifiers/6037/6 "2022-12-04T21:03:21Z")

</div>

> [@merlin](#):
>
> Was your intention to have a single tap act like a one-shot modifier, but a double tap emit a printable character? If so, it would be more natural (and reliable) to combine TapDance with OneShot, rather than SpaceCadet.

That sounds like my best bet. What is the best way to go about customizing the firmware like that? I’m still not sure if I should do all my customization in the .ino file and forget about Chrysalis, or if I can enable some plugins on the .ino file and upload it with Chrysalis (the attempts I’ve made with Qukeys for instance don’t seem to work, maybe due to the fact that Chrysalis already uses 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:** [December 5, 2022, 3:24pm UTC](https://community.keyboard.io/t/disable-oneshot-stickability-for-modifiers/6037/7 "2022-12-05T15:24:25Z")

</div>

To set up TapDance, you’ll have to use a custom sketch. There is a TapDance example sketch that can help with that. Custom sketches can still be used with Chrysalis; it’s not an either/or proposition. I got the impression from your earlier posts that you were able to flash keyboard firmware with a custom sketch; you don’t need to do this with Chrysalis (but you probably need to reset the EEPROM after doing so to keep plugins from reading incorrect configuration data).

---

<div class="post-metadata">

**Author:** ![MalarJuggler](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@MalarJuggler](https://community.keyboard.io/u/MalarJuggler)\
**Post date:** [December 5, 2022, 8:13pm UTC](https://community.keyboard.io/t/disable-oneshot-stickability-for-modifiers/6037/8 "2022-12-05T20:13:37Z")

</div>

Thanks for the context. I did upload a custom firmware, but one that didn’t introduce new data to be persisted - it only changed the boot glow key. I had the impression that by using Chrysalis to flash the firmware I would be safe from issues with the configuration data since I see that it saves the data and then restores it. If I understand correctly, the restored data can still be invalid if plugins are added/removed, then?

This kind of makes me want to move from Dynamic Macros to regular Macros at some point, since I risk losing those with an EEPROM reset.

---

<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:** [December 6, 2022, 5:29pm UTC](https://community.keyboard.io/t/disable-oneshot-stickability-for-modifiers/6037/9 "2022-12-06T17:29:12Z")

</div>

> [@MalarJuggler](#):
>
> If I understand correctly, the restored data can still be invalid if plugins are added/removed, then?

I don’t know enough about Chrysalis to answer this question. @algernon?
