Sunday, May 10, 2009

Dvorak keyboard for Netbooks with Ubuntu

I got my Dell 9" Inspiron this weekend with the intention of taking it with me on AIDS/Lifecycle 8, tethered to my phone, so I can stay in touch during the ride. I got a refurb with Ubuntu on it, partly because it was the cheapest refurb they had but also because I figured a low-powered device would fare better with Linux than Windows XP. I've never tried Ubuntu before, being more of a FreeBSD fan, but I like the idea that it's based on Debian, which is probably the least cheesy Linux out there.

Ubuntu seems nice, and configuration is generally easy. They've apparently put a lot of effort into making many of these painful tasks simple, which I like. For something I plan to use as a desktop, I generally want to avoid editing system configuration files, rebuilding kernels, and generally geek-fapping. I'm too old for that shit.

One thing I did bother with, however, is the keyboard layout. I've been a Dvorak keyboard user since about 1998 when I switched over to alleviate some RSI trouble. Unfortunately, the netbook is really optimized for QWERTY; they've made some of the keys with special characters quite small. The good news is that most of these keys are meant to be hit with the right pinky finger, with the exception of the comma, period and slash keys (w, v, z in Dvorak). Fortunately these keys are used less frequently in most English writing.

One thing I desperately needed to fix was the positioning of the slash key. On a normal Dvorak keyboard, the left bracket becomes slash, and the right bracket becomes equals. (The hyphen moves to the apostrophe and the apostrophe moves to Q.) On a netbook, however, there are no separate keys for left and right brackets; in their place are the hyphen and equals. I use the slash key quite a bit, certainly more than the bracket keys, so it's more important to put the slash key in the right place than to maintain the re-mapping of the hyphen and equals keys.

To make a long story short, I decided to create an xkb dvorak variant that puts the slash where it "belongs" (right pinky finger, top row to the right of the 'P' key), and leaves the = in its original location, along with the braces and brackets.

This, it turns out, is a little bit of a pain in the ass, but doable.

I'm using a US keyboard, so first, I edited /etc/X11/xkb/symbols/us, adding this just after the regular dvorak entry:
partial alphanumeric_keys
xkb_symbols "dvorak-netbook" {
name[Group1]= "USA - Dvorak for Netbook";

include "us(dvorak)"

key <AE11> { [ slash, question ] };
key <AE12> { [ equal, plus ] };
key <AD11> { [ bracketleft, braceleft ] };
key <AD12> { [ bracketright, braceright ] };
};

That's the part that does the actual work. Now you must tell X/Gnome about what you've done. Edit /etc/X11/xkb/symbols.dir and add --p----- a------- us(dvorak-netbook) immediately after the us(dvorak) line. The resulting section will look like this:
-dp----- am------ us(basic)
--p----- a------- us(colemak)
--p----- a------- us(dvorak)
--p----- a------- us(dvorak-classic)
--p----- a------- us(dvorak-netbook)
--p----- a------- us(dvorak-l)
--p----- a------- us(dvorak-r)

Next, edit /etc/X11/xkb/rules/base.lst and add dvorak-netbook us: Dvorak for Netbook after the existing dvorak entries. The end result looks like this:
  dvorak          us: Dvorak
dvorak-intl us: Dvorak international
dvorak-l us: Left handed Dvorak
dvorak-r us: Right handed Dvorak
dvorak-classic us: Classic Dvorak
dvorak-netbook us: Dvorak for Netbook

For the last manual configuration bit, edit /etc/X11/xkb/base.xml, adding this block immediately after the existing dvorak entry:
        <variant>
<configItem>
<name>dvorak-netbook</name>
<description>Dvorak for Netbook</description>
</configItem>
</variant>

Once all of this is done, you can select the Dvorak for Netbook option in the Keyboard preferences in Gnome. I've observed that this particular preferences panel is a bit buggy; you may find it works better to remove other keyboard layouts once you've added the Dvorak for Netbook layout.

I'm still toying with the idea of swapping the locations of equals and hypen, since the hypen gets used fairly frequently, and with the dvorak mapping to the apostrophe, it ends up in an inconvenient location right of the spacebar. I keep hitting enter when I want a hyphen, since it really should be to the right of the semicolon key (the "S" in the Dvorak layout). I'll wait and see if I tend to use equals or hyphen more frequently. Both are pressed with the right pinky finger. There are other options as well, such as putting them all on the same key but accessing plus and equals via the ALT and ALT+SHIFT...

...but at least I know where to go if/when I decide to make that change.

Labels: , , , ,


This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]