I've got a very noobish question for the pros here...
If I hit, say, the 'fn' key on my HHKB Pro 2 by itself, it doesn't generate any keycode that the OS can see. For example under Linux if I launch 'xev' and then hit the 'fn' key, nothing happens. If I press 'fn', then hit ';' then a code corresponding to the left arrow is sent and, AFAIK, the OS has no way to detect that ';' was pressed. For the OS it's as if my keyboard had a real arrow keys cluster. (please correct me if I'm way off here)
Now here comes my question (and the example I'll use is, on purpose, far-fetched, to try to better understand how it all works): can I somehow "add" a device/controller between the keyboard and the computer that would allow to:
- hit the key 's' and have no keycode send to the computer unless I hit another key ?
- press the key 's' and keep it pressed and then hit 'y' and have the code equivalent to hitting the right arrow key send? (without the OS being able to determine that 's' or 'y' were pressed)
If it can be done, does it work with any key (any modifier etc.)? What about the 'fn' key itself, which doesn't send anything unless you hit another key? (not that I'd miss it much)
Basically instead of having to remap all my OSes (say Linux, OpenBSD, OS X, Windows, ...) so that my keyboard(s) behave more or less similarly on all of them, I was wondering if it was possible to do this at a lower level, entirely bypassing the OS?
Yes it is possible. This problem has already been solved brilliantly by Hasu.
He has designed several masterpieces:
1. An alternate controller for the HHKB. It replaces the controller inside the HHKB, which is on a small PCB that is separate from the PCB that supports the keys. The controller allows to remap any key, including Fn, and to define dual role modifiers. I am typing this post on an HHKB with said controller, and it implements the SpaceFN layout perfectly. But you could program it to do anything.
2. A converter that plugs between a keyboard and a PC (or Mac). The converter takes the incoming key presses/releases sent by the keyboard and converts them to do anything you want. I also have this converter, which is currently programmed to convert a standard keyboard into a SpaceFN keyboard. I use it with a Poker. The only limitation is that your keyboard must be PS/2 compatible. That is, if it's a USB keyboard, it must work when plugged to the PS/2 plug of a PC (thru the classical passive USB to PS/2 adapter).
3. A controller for the GH60 keyboard that allows to program any layout. That includes dual-role modifiers.
As far as I know, he has designed both the hardware and software (firmware) for all of these. The firmware, which is essentially the same for the 3 devices above, is called "TMK".
If you have an HHKB, you need #1. You will lose the USB hub, but I have been told that it is almost completely useless anyway.
If you have other standard keyboards (or TKL or even 60%), you need #2.
I do not know if Hasu wants to sell more of these adapters and controllers. You will need to ask him.
I do know that they work really well and that they are like little treasures in my keyboards collection.