The short answer, no. The state of Caps Lock is entirely in host software, to the keyboard it is just another key.
To get what you’re looking would require some very expensive mechanical contraption to reflect the state of the LED. And then what if you have reassigned Caps Lock, as is common?
As cool as it might look it’s going to be a very limited niche.
USB HID does have codes for locking versions of Caps Lock, Num Lock, and Scroll Lock¹. OS X might support these, given that older Mac keyboards had locking Caps Lock. Linux doesn't².
Having written USB HID code for barcode scanners where this came up (thrilling I know). None of the major OSes support it including OS X. It’s sort of a homage to a historical artifact (that table dates to the early 90s) but useless because even if you use those old keyboards you will have to emulate with the usual scan code.
Barcode scanners are cool. I'm working on setting up a barcode system for my personal library and then probably home inventory. Do you have any recommendations?
I found 4 used scanners for cheap (Datalogic Gryphon GD4400).
I mean sure, in theory something else can activate caps lock. In practice, it's only ever activated through a button press on the keyboard used. Caps lock being activated by something else or being reassigned to another button is the edge case here.
A laptop with external keyboard is not exactly an edge case. In Windows the caps lock state is per session, not per keyboard and I believe this is the case with most Linux desktops, the Mac is an exception here. Even there, the other case you are missing in your truth table is button depressed when not connected (ie the initial state). None of the common OS have locking support out of the box.
> Caps lock being activated by something else or being reassigned to another button is the edge case here.
BS. There is more variety to the assignment of the caps lock key then I think you realize even if in isolation some of them are edge cases (input method switching is a big one).
https://support.apple.com/en-euro/guide/mac-help/mchl84525d7...
Windows has similar including chords in the standard configuration for Japanese on non Japanese keyboards.
I think pointing out edge cases while ignoring that the request is for something that doesn’t exist with no evidence of high demand is an edge case is quite silly.
I was going to say just get a Cherry MX lock and pop it in, but those have been discontinued for what seem to me to be obvious reasons.
That’s not how it works because it is more flexible and sensible to do the translation of a physical key location to a logical function within the OS. While fancier keyboards do allow alternate key maps and macros, your basic standard keyboard is just a stateless matrix of numbers (scan codes).
Any hardwired button state handling or latching diminishes straightforward programmability on the OS side.
Understand that you can configure any modern OS for any arbitrary keyboard layout regardless of what type of keyboard is connected. The keyboard itself has no concept of what is a capital letter and what is a lowercase letter, it’s just buttons. This makes sense, because at the end of the day touch typists don’t really care what is printed on the keycaps. If I want to use Chinese (eg pinyin), Japanese (which is a cluster of layouts), or Dvorak on a US keyboard why should it matter? This can be handled easily in the OS, the keyboard is dumb.
And the concept of uppercase and lowercase as it would apply to a QWERTY layout doesn’t make even make sense for many languages.
When you press the physical caps lock key you’re just sending a number just like the Q key or something. The OS decides what to do with it. I have virtually no use for caps lock personally so it’s a control key.
Using it as a dual purpose key for input method switching is not uncommon.
More generally another reason for not baking in functionality in the keyboard is provision of accessibility features such as Sticky Keys and Filter Keys.