Work Around for Capturing Caps Lock?


I’d like to put the Caps Lock key to good use in my keyboards and tried a rule of the form:

any(inGroup) + [K_CAPS] > index(outGroup,1)

the compiler gave me the warning:

Warning: line 296 warning 209A: The rule will never be matched because its key code is never fired.

Then saw the Virtual Keys documentation which indicates that K_CAPS is a place holder (extra virtual!). Is there a work around to detect a caps lock keystrike in a rule?


No, Keyman will never match on the K_CAPS virtual key. Because of the side-effects around Caps Lock, and application assumptions, we’ve never supported Caps Lock in rules like this. We do support matching on Caps Lock with NCAPS and CAPS modifiers in virtual key rules (e.g. + [NCAPS K_A] > ...). See also the Caps Lock header system stores.

On Windows I use a tool called SharpKeys, and on OSX a tool called Seil to swap the Caps Lock and Escape keys. Can Keyman support swapping with Caps Lock? My hope is that the keys could be swapped, then use K_ESC in the same rule as per:

any(inGroup) + [K_ESC] > index(outGroup,1)


Swapping keys like that is not something we currently support (and we wouldn’t encourage overloading Escape in any case because it is used for so many other things.)