(last updated: 2004-01-29.)


I use a pretty generic US keyboard, which comes with the normal characters, two "Windows" keys, and a "Menu" key. This is clearly not enough to enter everything I might want to write.


Keyboard setup in the Linux console and in X are very different. Of course, the Linux console lacks the support X does for extended fonts anyway, so there's not much use in running in console mode if you want these extra characters.

In X, run xev to find the keycode of a key. Hit the relevant key when the mouse is over the xev window and watch the console. For example, the "Menu" key on my keyboard (which is to the right of the spacebar: alt, windows, menu, ctrl) is keycode 116.

The commands listed below are xmodmap commands. You can run them as xmodmap -e 'command'. Put them in your ~/.xsession to make the settings persist.

Extended Characters

You can use a "mode switch" key to assign more than two meanings to each of your keys. Right now, a key like "d" produces a "d" when pressed normally, and a "D" when pressed while holding shift. How about making it also usable for producing a "degree" symbol?

First, map some key to "Mode_switch", which works as a sort of extended "Shift" key. I used my right alt, keycode 113. Then map extra keys, following the pattern here:

keycode 113 = Mode_switch
keysym d = d NoSymbol degree     NoSymbol
keysym e = e NoSymbol EuroSign   NoSymbol
keysym m = m NoSymbol emdash     mu
keysym n = n NoSymbol endash     NoSymbol
keycode 34 = bracketleft braceleft
             leftsinglequotemark leftdoublequotemark
keycode 35 = bracketright braceright
             rightsinglequotemark rightdoublequotemark
keysym space = space NoSymbol nobreakspace NoSymbol
keysym minus = minus underscore 0x01002212 NoSymbol

For example, right alt + left bracket now produces a single left quote, while holding shift and hitting that produces a double left quote. Also noteworthy are the em and en dashes. (Adapted from an email from Markus Kuhn to the x18n mailing list.)

European Languages

You can use a "compose" key to get extra characters while keeping your existing keyboard map. For example, I can type [Compose]["][u] and I get a u with an umlaut, if I were in the mood to type German. Setting up your compose key is simple: run xmodmap to map a key to "Multi_key":

xmodmap -e 'keycode xx = Multi_key'


As with almost everything Japanese, Japanese input is more difficult.

Japanese input boils down to a few separate layers:

Once you've installed all of this software, you need some more configuration:

kinput2 must be run with an EUC-JP locale:

LANG=ja_JP.EUC-JP kinput2 &

And then run your program (mlterm is a good terminal) with a Japanese locale (I like UTF-8, myself):

LANG=ja_JP.UTF-8 someprogram &

Finally, hit shift-space to flip into Japanese and hit it again to exit. Type using romanji, then hit space to convert it to kanji (and space to cycle through the candidates), and hit enter when you've completed a word.


im-ja is a Japanese input module for GTK2 that uses canna directly. This circumvents the potential problems with kinput2 and XIM and would (in theory) integrate better. From my tests, it seems incomplete, but it's a good project to keep your eye on.

Evan Martin,