Feb 6, 2019

Are Shift/Capslock a dedicated Layer?

In looking at how key presses are sent to from the keyboard to the computer, most keys have a "normal" and a "shifted" state. What's unclear to me is how the keyboard sends the shifted state -- Does it send "shift" (or CapsLock) as a modifier and the computer converts the keystroke or does it send the shifted state, and just includes shift (or capslock) as a courtsey flag? I assume that NumberLock behaves in the same way as CapsLock and that the number pad keys are just an different 'shift' set? Is it possible to "map" both "shift" and "numberlock" alternate signals to one key? Where I'm going with this is I'd like to add laptop style number pad to one of my TKL keyboards, but I'm not sure if I need to do so by making the "number pad mode" key a Layer, and build in toggling the numpad "key" into the macro to toggle that layer off and on? -- I don't want to only add the number pad keys, I want a few other keys to be remapped to allow for other functions I typically use with numerical entry.
thumb_up
Duncan
thumb_up1
1
bookmark_borderSave


Shifting is done by the host - the keyboard just sends shift up/down - this is why changing the keyboard layout on the host changes what you get when you shift a keypress. Lock keys work similarly, except host keeps track of lock state and board just receives this (for indicator lights etc.). Remember that the protocols involved here are generally designed for the keyboard being dumb and the OS taking care of most things - state in particular. When in doubt when designing keyboard behaviour, of the possible protocol behaviours the one assuming the least smarts from the board is probably correct.
(Edited)