Dvorak in X-Windows

If, like me, you are occasionally burdened with the necessity of using the X-Windows interface on a Unix machine, take heart: you can remap the keyboard to a Dvorak layout. This is somewhat tricky operation because the details may depend on the particular hardware. However, the procedure below should guide you through it as painlessly as possible.

1. Make a "backup" of your keyboard map.

At the Unix prompt, type

     xmodmap -pke > original.pke
This will create a file called original.pke which contains the current map of your keyboard. It should look something like this, though the details may vary, especially for the function keys.

To make sure you can restore your keyboard if it gets confused, type

     alias aaa xmodmap original.pke
This creates a new, temporary command aaa which will restore your keyboard to its original settings; just type "aaa" (in either Qwerty or Dvorak) to execute it. (Note that this command goes away when you log out.)

2. Make a Dvorak version of the file.

Again at the Unix prompt, type the following:

     cp original.pke dvorak.pke
     pico dvorak.pke
The first command creates a copy of the file under the new name of dvorak.pke, and the second command starts a text editor so that you can modify it. (Instead of pico, you can use your favorite text editor such as emacs or even (gasp!) vi.)

Now edit the file to reflect the differences between Qwerty and Dvorak. You can use the keyboard layout diagram and my sample dvorak.pke to guide you. (You did make a printout of these, right?) Exit the editor when you're done (in pico, hit Control-X, then Return).

3. Create commands for switching back and forth.

To create lasting commands, edit your .cshrc file:

     pico .cshrc
This is a big confusing file, but non-Mac users should be accustomed to that. You should see a bunch of lines which start with "alias" someplace. If you don't, you may see a line like "source .alias", in which case you want to exit this file, and do "edit .alias" instead.

Now add the following lines:

          alias dvorak 'xmodmap dvorak.pke'
          alias aaa 'xmodmap original.pke'
If you want to automatically start in Dvorak, then also add "dvorak" on a line by itself (without the quotes) at the end of the file.

4. Log out and back in, and you're all set!

Now, when you're in Qwerty, you can type dvorak to switch to Dvorak. You can switch back by typing aaa. (Why "aaa"? One, because your Dvorak-ignorant friends can type it even on a Dvorak keyboard, and two, because that's the sound they make when they start typing and discover that they're not in Qwerty.)


Good Luck!