Chrysalis: modifier and layer shift on one key

I noticed in Chrysalis there is no way to have both a Secondary Action > Layer Shift … and a modifier. Specifically I want a key to be left paren normally and layer shift when held. I can do this by putting the layer shift into the firmware with a Qukey. I’m wondering if it’s possible to have Chrysalis support this also. Does Chrysalis use Qukeys for the Secondary Action > Layer Shift?

Answered in Discord by @gdxpr:

It’s complicated. Qukeys currently has two completely independent ways of defining qukeys, because it began as a third-party (me) alternative to the original DualUse plugin. DualUse keys can be defined in the keymap itself, using a range of Key values that can be decoded into a modifier or layer shift when held and a base key when tapped. Those are the ones that Chrysalis can define, because it’s a simple matter of assigning the right value to an entry in the keymap.

The “full” Qukey type requires more than two bytes, so cannot be stored in the keymap, and is instead stored in an array defined in program memory, which means that changing it requires rebuilding the firmware. A Qukey defines an alternate value to be used for a given layer and key position, and that alternate value can be any valid Key (just like the entry in the keymap, referred to as the primary value).

There is one twist, however: if the primary value for a Qukey (i.e. the keymap entry) is a modifier (or a layer shift), then the behaviour of Qukeys changes, and it acts like SpaceCadet instead. Holding the key will produce the primary value, and tapping it is the alternate. The mechanics of how to deal with rollover are likewise different.

In the future, I would like to introduce a third way of defining qukeys, which will allow for storage in EEPROM, with additions to Chrysalis to allow you to define them without recompiling the firmware. Then, eventually, the old layer-and-address Qukey objects would be dropped. When that happens, I’d also like to deprecate the SpaceCadet plugin, and let Qukeys take over handling that functionality as well, since it already does everything SpaceCadet can do.