Smart Common Input Method

From ArchWiki
Revision as of 14:46, 2 August 2012 by Alexfikl (talk | contribs) (renamed
Jump to navigation Jump to search

zh-CN:Smart Common Input Method platform zh-TW:Smart Common Input Method platform

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: the note below reports SCIM as unmaintained, but the latest release is dated 2012/04/29: (Discuss in Talk:Smart Common Input Method#)
Note: SCIM is "unmaintained upstream", whereas IBus is still under active maintenance by Red Hat. Arch users may want to consider IBus or UIM instead of SCIM for a new install.

Su Zhe (or James Su)-who at that time worked for TurboLinux- started this project about 2001 with the goal:

  • Act as an unified frontend for current available input method libraries. Currently bindings to uim and m17n library are available.
  • Act as a language engine of IIIMF input method framework (TBD).
  • Provide as many native IMEngines as possible.
  • Support as many input method protocol/interface as possible.
  • Support as many operating systems as possible.

SCIM has the following features:

  • Fully Object Oriented structure written in C++.
  • Highly modularized.
  • Very flexible architecture, can be used as a dynamically loaded library as well as a C/S input method environment.
  • Simple programming interface.
  • Fully i18n support with UCS-4/UTF-8 encoding.
  • Include many handy utility functions to speedup the development.
  • GUI Panel with very rich features.
  • Unified configuration framework.

Installing SCIM

# pacman -S scim

Installing Input Method Engines

Currently the SCIM project has a wide range of input methods (some may need other libraries), covering more than 30 languages, including (Simplified/Traditional) Chinese, Japanese, Korean and many European languages. These are some of the examples (more can be found here):

Chinese Smart PinYin:

# pacman -S scim-pinyin

Chinese WuBi or other tables based:

# pacman -S scim-tables


# pacman -S scim-anthy


# pacman -S scim-hangul

Configure SCIM

In order to work correctly, SCIM configuration needs three steps:

1. exporting environment variables

2. modify locale-related files

3. start the application

Method 1: === Best case example ===

If you use a good DE/WM and do need SCIM to work urgently, put these lines into /etc/profile or ~/.xprofile, then reboot:

export GTK_IM_MODULE="scim"
export QT_IM_MODULE="scim"
scim -d

This is also the base example. The Correct Way of Doing Things is presented below, together with some common variants.

Method 2: === Just a try ===

If you use GNOME, edit /etc/gtk-2.0/gtk.immodules. Add follow content to the end.

 "scim" "SCIM Input Method" "scim" "/usr/share/locale" "ja:ko:zh"

If your LC_CTYPE is en_US.UTF-8, change "ja:ko:zh" to "en:ja:ko:zh". You can find im-modules when you execute gtk-query-immodules-2.0. Reboot. Maybe you will find there is no SCIM tray icon. But when you type CTRL + SPACE, the SCIM bar will show if you have enabled some INPUT METHODs. Maybe the QT immodules is the same way.Caution: GNOME PANEL may disappear sometime when your PC boots. You can turn to SHELL with typing CTRL + ALT + F1, and execute sudo reboot or reboot. You can edit /etc/gtk-2.0/gtk.immodules with vi or vim.

Environment variables

Following environment variables have to be exported before executing scim:

export GTK_IM_MODULE="scim"
export QT_IM_MODULE="scim"

It is usual to put these lines into some script file, e.g. ~/.xinitrc or /etc/profile (for global settings), or also ~/.config/openbox/autostart (if you use Openbox as WM). If you put them into ~/.xinitrc, they have to be put before executing your DE/WM.

If you do not know which solution is the right one for you, just use /etc/profile.

Note: The first environment variable conflicts with some (unusual) options like XMODIFIERS=urxvt.

Note for amsn users

You must also export the following variable to be able to use scim input with amsn.

export XIM_MODULE="scim -d"


If export QT_IM_MODULE="scim" didn't work for you, you can use 'scim-bridge from AUR. This configuration is working in GNOME, XFCE, LXDE with last updates on 2009.02.15 (scim 1.4.7-1, scim-bridge 0.4.15-1 from AUR). Like this:

export QT_IM_MODULE="scim-bridge"

Note for KDE3

For KDE you should either change QT IMM to xim, or have scim-qtimm-cvs installed from AUR. Like this:

export QT_IM_MODULE="xim"

Note for GTK

If scim doesn't work with gtk applications, check GTK_IM_MODULE_FILE environment variable. It has to be set to /etc/gtk-2.0/gtk.immodules or other location that has the needed file containing input method modules.

Adding the following lines to the script file mentioned before should work. The lines should be put before executing your DE/WM:

gtk-query-immodules-2.0 > ~/.immodules
export GTK_IM_MODULE_FILE=~/.immodules

GTK will now look into ~/.immodules file. You can set the GTK_IM_MODULE_FILE to /etc/gtk-2.0/gtk.immodules, in that case you do not need the first line.

Locale-related files

If your keyboard locale is en_US.UTF-8 (or en_US.utf8), just skip this second step.

If your keyboard locale is not en_US.UTF-8 (nor en_US.utf8), you have to modify the first line of ~/.scim/global (or /etc/scim/global to have an user-indipendent effect) according to the following example:

/SupportedUnicodeLocales = en_US.UTF-8,de_CH.UTF-8

Obviously, you have to put your locale instead of de_CH.UTF-8.

Note: Your locale has to be active (i.e. you have to uncomment it in /etc/locale-gen and then execute locale-gen as root) and has to be supported by SCIM (most *.UTF-8 locales are).

If you do not know which locales you have active at the moment, you can check it:

locale -a

(alternatively you can look at /etc/locale.gen).

Further troubleshooting with locales

If after you have install scim and the necessary input tables, and scim still doesn't work (click on the system tray, and nothing pops up), then you need to set the LC_CTYPE environmental variable in /etc/profile to the locale you plan to use. Simply create an entry for LC_CTYPE in /etc/profile, if there isn't one.

eg.   LC_CTYPE="zh_CN.UTF-8"              //if you want to type simplified chinese

Finally you need to generate the locale using the locale-gen command. Modify the /etc/locale.gen file to uncomment the language and encoding set you wish to use scim with. Then run the following command to generate the locale for your system.


Executing SCIM

To execute SCIM, you usually can just execute (but see below):


It is common to start SCIM as a daemon, so that you can use your computer/terminal while SCIM is working. That is, the normal case is to execute:

scim -d

As above, it is a common practice to put this command into some script file instead of executing it explicitely. As above, usual places are ~/.xinitrc (after environment variables and before DE/WM), /etc/profile (after environment variables) or ~/.config/openbox/ (after environment variables and possibly after some sleep command).

Note for GNOME

In case you use GNOME as DE, the command above seems not to work as expected. Instead, you have to execute the following:

 scim -f x11 -c simple -d

If you want SCIM to start automatically at startup, go to System > Preferences > Session and create a new command with the line above.

Note: If you use the line scim -f socket -c socket -d instead, the configuration of your SCIM will be unmodifiable.

Note for KDE

In case you use KDE as a DE, the command above seems not to work as expected. Instead, you have to execute the following:

 scim -f socket -c socket -d

You can also apply following optional steps:

1. Install skim from the AUR.

2. Start SKIM, right click on the system tray icon and click 'Configure'

3. Under Frontend > X Window, tick the checkbox for "Start skim automatically when KDE starts"

4. Logout and restart X server (ctrl+alt+del), then login again

In any application, press ctrl+space to activate the input window.


LWJGL (Lightweight Java Game Library) losing keyboard focus

See [1] and [2]. A "solution" is to kill scim and the application will accept keyboard input again.