At the Unix prompt, type
xmodmap -pke > original.pkeThis 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.pkeThis 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.)
Again at the Unix prompt, type the following:
cp original.pke dvorak.pke pico dvorak.pkeThe 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).
To create lasting commands, edit your .cshrc file:
pico .cshrcThis 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.
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.)