Setup multilingual Japanese environment for non-gtk apps in Gnome
May 31, 2007 5 Comments
Due to some annoyances with scim, the Ubuntu default input system, and due to my own personal preference for uim, the first thing I usually do on a fresh Ubuntu install is remove all support for scim, and install uim-gtk. However, this leaves me without Japanese input for the occasional KDE or QT application. This is where uim-xim comes in. The uim-xim package README indicates this is only a temporary workaround to enable input for applications that are without direct uim support, but it’s good enough for me until there’s a usable qt-uim package. I’ll describe what I did for konqueror. Let’s assume you’ve just installed Ubuntu or Debian. All packages mentioned are included in the Ubuntu and Debian releases I’ve tried.
First, open synaptic, adept, (or dselect, for all I care) and search scim and skim. Remove any packages that turn up. don’t worry about removing package ubuntu-desktop, since it’s only a meta-package to bring in the basic desktop applications, of which scim is one. I also usually dump canna, skk, or whatever other server based CJK input systems if they are present. I recommend anthy for its elegance and ease of use. Next, install uim-gtk2.0, uim-anthy, and uim-applet-gnome, which should bring in any required dependencies.
Moving right along, in a Gnome session, add uim panel applet, or simply start it from the command line or alt-f2, and make sure it becomes part of your session. The next thing to do is set up how you want to activate anthy input via uim. That is, by keystrokes, using the gui or a combination thereof. This might require a few quick log out and log back ins to make sure your changes are activated upon system start. Most users will want custom defaults, so I won’t go into too much detail here. My standard approach is to have Gnome use all English for menus and input, and if I need to do a bunch of Japanese input, I switch to uim-anthy via the gui applet. Once activated, I can switch between Japanese and English input by hitting shift-space. If I want to go back to all English, I de-activate anthy by selecting direct input in the panel applet.
This is all fine if you only use gtk applications, but what about with kde or other non-gtk programs? That’s where uim-xim comes in. This should work for kmail, konqueror, or any other program with xim support. First, install uim-xim. Next, write a simple script to do complete several actions required for the uim-xim bridging. This is my konqueror script, which I saved as kanjikonq in nano:
uim-xim -engine=anthy &
After running chmod +x on the script, I add a launcher for konqueror to my panel, and change the run command to the kanjikonq script. Clicking the customized panel icon opens up konqueror in Japanese input mode. Hitting shift-space cycles between roman and kanji input. I can also turn off anthy completely, via ctrl-space, if I need to do a bunch of English input. This is all configurable in the uim-gtk panel applet preferences dialog. I tried opening multiple instances of konqueror with this script and it looks like uim-xim is only started once, the first time you run the script, so no unnecessary duplicate processes will be running.
So, there you have it. A relatively simple way to deal with Japanese (or any other CJK) input for a multilingual desktop that’s not limited to a single desktop environment.