Can you make a double modifier key OneShot without AutoModifiers?

I have a Control-Shift key I want to make OneShot, but OSM(LCTRL(Key_LeftShift)) does not work.

The docs for OneShot say:

.enableAutoModifiers()

.disableAutoModifiers()

.toggleAutoModifiers()

Enables/disables/toggles auto-oneshot functionality for modifier keys. When enabled, all normal modifier keys, including those with other modifier flags added to them (e.g. LSHIFT(Key_LeftAlt), Key_Meh) will be automatically treated as one-shot keys, in addition to dedicated ones like OSM(LeftGui).

So if I understand this correctly, it would work to just make the key LCTRL(Key_LeftShift), and then enable AutoModifiers.

Is there a way to do this without enabling AutoModifiers?

No, because a Key object has only 16 bits, and OneShot doesn’t have a large enough range for that. There are a couple of other things you can do, however, if you really don’t want other modifiers to become one-shot keys automatically. You can use a custom plugin and a special key value (or set of values) to convert that key into a modifier combo, then call ::OneShot.setPending(event.addr) (I think that’s the correct function to call) when it is pressed. Or you can single out the modifiers that you don’t want to become auto-one-shots, and just use modifier flags on them (e.g. LCTRL(Key_NoKey))—OneShot will not automatically turn such a key into a one-shot. The downside is that other plugins also won’t identify such a key as a modifier (e.g. CharShift).

1 Like

Thank you! I ended up just going with AutoModifiers which works great!

1 Like