Keyboard quirks on the Japanese Macbook Pro

by Carson Reynolds

Xmodmap for Japanese Macbook Pro Keyboards
So, you are in the unlikely position of using a Japanese model Macbook Pro with X11 and you notice that the keyboard is all wacky. It seems like they shipped the English modmap, which is pretty inconvenient since it doesn’t map the keys correctly.

Over on this blog I found a modmap which partly alleviates the problem. However, I still had some problems on my notebook, in particular the shift keys don’t work correctly. I decided this was because the file maps a few too many keys to nothing at all. To remedy this, I used sed to remove the lines ending with equal signs:

sed '/=$/d' Xmodmap.broken > .Xmodmap

The resulting .Xmodmap, placed in my home directory works well. This is on OS X Leopard, with a late 2006 model Macbook Pro.

Emacs, ¥, 円, and Backslash
Another annoyance is that Emacs (in particular Aquamacs) seems to always insert Yen symbols. The terminal is set up such that a press of the ¥ key causes a \ to be input. This is convenient in that backslash is used frequently in many Unix-style programs such as latex and bash.

After some experimenting, I found that if you add the following line to your .emacs file, the ¥ key will emit \ just like the terminal:

(global-set-key [2213] "\\\\")

This might save a lot of headaches if you enter backslash more frequently then yen. And of course the symbol most commonly used in Japan for Yen is 円.

Advertisements