2008-10-12T11:29:58Z
Dave Pawson.
link
Home
Keyboard mappings
As I reported earlier, I'm slowly learning to use a keyboard with a dvorak layout. One of the problems I'm having is that there doesn't seem to be much in the way of a 'standard' dvorak layout beyond the basic keys?
Investigating this, I came across the mirky world of keyboards, about which, to be honest, I'd been almost totally ignorant. Way back in the eighties I helped set up a rugged system which was quite peculiar, but that was a one off, not on a general purpose PC. Once I started reading, the logic was there. My keyboard is slightly different to others, from different manufacturers. Different again from someones in France or the Netherlands. Quite different from one in Japan or China. No problem. The world of X servers and xkb takes this into something akin to standardisation. The steps seem to be to take the numerical value emitted when I hit a key (scancode) and convert it into a 'logical' keycode. Take a random keyboard and map the key vectors to a spatial map. Bottom row A, (my case) top row E. Number them left to right and for me, the A key is AC01. The initial A separates the alphanumeric keys from the function keys and specials, which take on a life of their own. Also helps with the 'multi media' keys that some kbd manufacturers keep piling on. The next mapping is between the key pressed and the character which shows up in the X window application (Which doesn't necessarily map cleanly onto a more standard terminal interface - however, I'll stick to X apps for the moment). This produces another 'map', from keycode to a corresponding action. Normally the action is to emit a character, but it could be to totally remap the keyboard. The final action is for this 'character' to be displayed.... always assuming you have the appropriate font loaded! Again standard 'names' appear for these symcodes, see linuxquestions for some of the names. No idea where the definitive list is to be found.
I eventually achieved what I wanted, though not without a little
struggle. I'm still unclear about the path traced from the OS load through to the final mapping, but I'll trace it out here
as a record of what I found. The starting point seems to be /etc/X11/xorg.conf, which sets configuration for the X server. Of interest is the InputDevice section, from which mine reads
Section "InputDevice" # DP Oct 08. Changed. added grp:, dvorak layout # SkbModel was "pc105". New one selected from base.lst Identifier "Keyboard0" Driver "kbd" Option "XkbModel" "microsoft" Option "XkbLayout" "gb,dvorak" Option "XkbOptions" "grp:alt_shift_toggle" EndSection
I'm left with questions about the syntax and semantics of this config file for which I haven't found clear answers as yet. this was proffered as an information source though I haven't spent much time with it as yet. This was also recommended, though it didn't seem either complete or definitive.
Through the xorg.conf file there is some (as yet quite magical)
connection to the xkb software on Linux. On my system (Fedora) this
resides at /usr/share/X11/xkb/, wherein lives (in the
rules directory) a couple of files, base.lst and base.xml. Also
xorg.lst and xorg.xml. I'm informed that xkb is moving towards an XML
solution, and that the lst file is derived from the XML one. How? I've
no idea. This (these?) files list the keyboard models, standard layouts and the variants to .... something. E.g. one of the
variants has
dvorak us: Dvorak
What does this tell us? This line is in the variant section... beneath the layout section. In xorg.conf I've selected dvorak as a layout. It may be that this line takes that selection, and intimates that the 'us' file, in the xkb/symbols directory should be used, and then the dvorak 'variant' selected within that. That's how it seems to work, but I've no information to back that up. I found this out by 'tweaking' the mapping from keysym to character.
Another angle of attack on this problem is via the system configuration. Fedora may be weak here. On a new install I'm always prompted for the locale and keyboard in use. I think perhaps this is the source of the selection in xorg.conf. When I replaced my keyboard.... no change is recognised by the system. When I go select a new keyboard using the system gui tools (system/preferences/hardware/keyboard) no change is made to xorg.conf. Ah well. Then I was foolish enough to select a keyboard which isn't listed by model on the available list... so I'm left with the doubt that I'm getting an appropriate mapping.
This saga isn't finished. I'll either update this entry, or create a new one. At least to show how I managed to get the changes incorporated.
Keywords: dvorak
Comments (View)Return to main index