But why need such a layer when the keyboard could easily handle it itself? Each USB keyboard would need its own special driver to be installed on the system? Or would you have instead a large list of USB IDs and associated layouts? With some separate mechanism to allow custom layouts, or something.
What's the problem with the keyboard knowing its own keys and just telling the symbol of the key that is pressed? Sure, it would still need some sort of escape sequence, or a way to mark whether a key's string is literal like Ù or symbolic like AltGr, but that doesn't sound too difficult.
It would also make it less difficult to add a new symbol like € to keyboards.
What's the problem with the keyboard knowing its own keys and just telling the symbol of the key that is pressed? Sure, it would still need some sort of escape sequence, or a way to mark whether a key's string is literal like Ù or symbolic like AltGr, but that doesn't sound too difficult.
It would also make it less difficult to add a new symbol like € to keyboards.