Keeping it Small and Simple

2008.01.17

Setting up SCIM on Debian

Filed under: Chinese, Debian, Japanese — Tags: , , , , , , , — Lorenzo E. Danielsson @ 01:46

I’m struggling to keep my Japanese and Chinese alive while learning Ga, programming and trying to uphold my hard-earned reputation as hopelessly lazy. In order to be able to input Chinese and Japanese text on my Linux boxes I use SCIM. There are now lots of good instructions out there, but I’ll outline what I did to get SCIM up and running just in case somebody is still struggling with it.

I’m not sure if these instructions apply to Gnome or KDE. Most likely, Japanese and Chinese are not user-friendly enough for Gnome, and KDE offers you a GUI tool to configure your input methods that is so complex you need a triple-degree in nuclear physics to figure it out. The following should work on a normal X window manager, which is the preferred way of using Linux for normal people.

Install SCIM and related packages

The best thing to do first is aptitude search scim. You will at least need scim itself. For Japanese I use anthy, and for Chinese I use scim-chinese and scim-chewing. I also have a few other packages, like scim-gtk2-immodule and scim-qtimm (you might need to grab that one from the Sid repos) installed.

Adapt the following to your own requirements. Note that there are several other input methods available with SCIM as well, such as Korean. Unfortunately, I don’t know Korean (yet) so it is not something I currently need.

aptitude install scim scim-anthy scim-chinese scim-chewing scim-gtk2-immodule scim-qtimm

Get fonts

You can do aptitude search ttf | grep Japanese to find Japanese fonts. A similar search will give you Chinese. You might also be able to find some others floating around at various places on the ‘Net.

Aptitude install the ones you want. You can, and probably should do a bunch of fine-tuning as well, such as organizing your fonts, so that the best fonts get selected. I normally only do such things once I get annoyed enough. That hasn’t happened quite yet.

Edit .zshenv

The way it *should* be done, all according to the people who really know, is to set environment variables in /etc/X11/xinit/xinput.d/*. But I’m a non-conformist, and moreover far to lazy to change something that works for me. I stuck the following in ~/.zshenv:

export XMODIFIERS='@im=SCIM'
export GTK_IM_MODULE="scim"
export QT_IM_MODULE="scim"

Of course, I could have added these lines to ~/.xinitrc instead. But these are just environment variables. No harm can come from them being set in ~/.zshenv. I’ve never had any problems.

At least I added the following to ~/.xinitrc:

scim -d

I put this before exec startfluxbox. There is no need to append a & since the -d will daemonize scim.

Activate scim

Simplest way to do this is to exit your window manager, source ~/.zshenv and restart X.

% . ~/.zshenv
% startx

Success stories

  • rxvt-unicode (some people say it doesn’t work, don’t know why. It works fine for me
  • (g)vim, which is what really matters. I use gtk2-vim so it’s a gtk2 application.
  • opera, although the fonts look ugly (guess I need to play around with that a bit). Opera uses qt3.
  • Iceweasel/Firefox, without the fonts looking ugly.
  • Netbeans, which proves that it works with Java/Swing as well. Fonts *cough, cough* don’t look too good, however..
  • gjiten, which is a gtk2 application
  • qt4-config. Seems to be the only thing I have available to test that it works with qt4.
  • tkremind, which shows that it works with Tcl/Tk as well.

So, SCIM works with the important applications (urxvt, gvim) as well as tk, gtk2, qt3, qt4 and Java/Swing applications. It does not seem to work with fbrun, however (not that it matters at all to me, just had to test it). If everybody had stuck to motif/lesstif I wouldn’t have had to test so many applications.

The Silver is the New Black Theme. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

Join 27 other followers