I’ve been using Dvorak on my home laptop for a little while now, and I’ve gotten to be reasonably decent at it. Not spectacular, but good enough that I can type for long periods of time without getting too annoyed at being needlessly slow. I’m not up to my old Qwerty speeds yet, but that’ll just take time.
Interestingly, I’m now pretty much bilingual. I can still use Qwerty keyboards as fast as I could before … so long as I don’t have to look at the keyboard to reposition; that screws me over, because I’m used to hunting for Dvorak keys now. I guess that might balance out over time.
That said, I was only using Dvorak within X on my laptop; my console was still configured as Qwerty. A weird bug in Gnome prompted me to just fix things so the laptop was 100% Dvorak.
The bug in question concerns another bit of keyboard snobbery on my part: I’ve preferred to switch around Caps Lock and Control for a good while now, because I use emacs a lot. It’s easier if I’m using a Control key that my pinkie is essentially always sitting next to, rather than the default Control key isolated way down on the bottom-left hand corner of the keyboard. (Interesting to note here that Dvorak is excellent for all those weird emacs key bindings. Excellent.) Anyways, something in Gnome broke, and my Control key toggled the Caps Lock light while still acting as a Control key – this became infuriating within moments, and so I went on the hunt for a better solution.
Thus, I present to you, dear reader, my solution, to completely Dvorakify my laptop from within X and on the console too.
Enabling Dvorak for X, if you don’t mind all users being affected, is actually rather easy. It’s all done in a couple of lines in my xorg.conf:
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "gb"
Option "XkbVariant" "dvorak"
Option "XkbOptions" "grp:shift_toggle,ctrl:swapcaps,ctrl:nocaps"
EndSection
It’s the last two lines here that make the difference: The XkbVariant tells X to use the UK Dvorak layout rather than the UK Qwerty layout. The XkbOptions are:
And that’s it for X. A dedicated UK Dvorak layout for all users with two additional lines of config.
The console was a bit trickier to pull off, with the UK/US Dvorak issue rearing its ugly head again. Luckily, easily fixed, after a little investigative work.
The Dvorak layouts for the console on Debian are stored under /usr/share/keymaps/i386/dvorak/; I copied the standard dvorak.kmap.gz to dvorak-gb.kmap.gz, and gunzipped it. It’s actually a fairly easy to understand file, so I modified it slightly from its initial state to this:
keymaps 0-2,4,6,8,12
alt_is_meta
include "linux-with-alt-and-altgr.inc"
strings as usual
keycode 1 = Escape Escape
keycode 2 = one exclam
keycode 3 = two quotedbl quotedbl
control keycode 3 = nul
keycode 4 = three pound
control keycode 4 = Escape
keycode 5 = four dollar dollar
control keycode 5 = Control_backslash
keycode 6 = five percent
control keycode 6 = Control_bracketright
keycode 7 = six asciicircum
control keycode 7 = Control_asciicircum
keycode 8 = seven ampersand braceleft
control keycode 8 = Control_underscore
keycode 9 = eight asterisk bracketleft
control keycode 9 = Delete
keycode 10 = nine parenleft bracketright
keycode 11 = zero parenright braceright
keycode 12 = bracketleft braceleft
control keycode 12 = Escape
keycode 13 = bracketright braceright asciitilde
control keycode 13 = Control_bracketright
keycode 14 = Delete Delete
keycode 15 = Tab Tab
keycode 16 = apostrophe at at
control keycode 16 = Control_g
keycode 17 = comma less
keycode 18 = period greater
keycode 19 = p
keycode 20 = y
keycode 21 = f
keycode 22 = g
keycode 23 = c
keycode 24 = r
keycode 25 = l
keycode 26 = slash question
control keycode 26 = Delete
keycode 27 = equal plus
keycode 28 = Return
alt keycode 28 = Meta_Control_m
keycode 29 = Control
keycode 30 = a
keycode 31 = o
keycode 32 = e
keycode 33 = u
keycode 34 = i
keycode 35 = d
keycode 36 = h
keycode 37 = t
keycode 38 = n
keycode 39 = s
keycode 40 = minus underscore backslash
control keycode 40 = Control_underscore
keycode 41 = grave asciitilde
control keycode 41 = nul
keycode 42 = Shift
keycode 43 = numbersign tilde
control keycode 43 = Control_backslash
keycode 44 = semicolon colon
keycode 45 = q
keycode 46 = j
keycode 47 = k
keycode 48 = x
keycode 49 = b
keycode 50 = m
keycode 51 = w
keycode 52 = v
keycode 53 = z
keycode 54 = Shift
keycode 56 = Alt
keycode 57 = space space
control keycode 57 = nul
keycode 58 = Control
keycode 86 = semicolon colon bar
alt keycode 86 = Meta_less
keycode 97 = Control
The 6 highlighted lines are all I’ve changed from the US Dvorak layout. I reckon there are a few strange keys I’ve not caught there, but it certainly does the main job. Notice also that there’s no Caps Lock here: I’ve simply bound the Caps Lock key (keycode 58) to Control, thus giving me the same Control/Caps Lock behaviour as I now have in X.
To load the new config, assuming you saved as /usr/share/keymaps/i386/dvorak/dvorak-gb.kmap as I did, run “loadkeys dvorak-gb”; to have it loaded automatically, stick the same line in your /etc/rc.local before the exit line, and you’ll be one happy chappy.
Posted by Stephen Strowes on Tuesday, May 13th, 2008. You can follow me on twitter.
All content, including images, © Stephen D. Strowes, 2000–2016. Hosted by Digital Ocean.