Q: how can I detect the keyboard layout from Emacs?
I'm writing some code that will set keybindings dynamically by selecting easy-to-reach keys (eg, those on home row). To do this, though, I need to to know which keys correspond to home row on the user's computer.
I could default to assuming that the computer uses the QWERTY layout, but that's not very portable for people using alternate layouts (I, myself, use Dvorak).
How would I detect the keyboard layout? Is there anything portable (in pure elisp) that does it, or would one need to drop to the system level to do it?
(I've browsed through various
*-input-method-* variables, and may have missed something obvious.)
PS: there's an old SO thread with a similar title that does not answer this question.