Difference between revisions of "Smart Common Input Method platform"

From ArchWiki
Jump to: navigation, search
(Environment variables: info about missing GTK_IM_MODULE_FILE)
m (added note + formatting)
Line 1: Line 1:
 
[[Category:Internationalization (English)]]
 
[[Category:Internationalization (English)]]
 
[[Category:HOWTOs (English)]]
 
[[Category:HOWTOs (English)]]
 
+
{{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.}}
 
{{i18n_links_start}}
 
{{i18n_links_start}}
 
{{i18n_entry|English|Scim}}
 
{{i18n_entry|English|Scim}}
Line 8: Line 8:
 
{{i18n_links_end}}
 
{{i18n_links_end}}
  
= About SCIM =
 
 
Su Zhe (or James Su)-who at that time worked for TurboLinux- started this project about 2001 with the goal:
 
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 an unified frontend for current available input method libraries. Currently bindings to uim and m17n library are available.
Line 26: Line 25:
 
* Unified configuration framework.
 
* Unified configuration framework.
  
= Installing SCIM =
+
== Installing SCIM ==
 
  # pacman -S scim
 
  # pacman -S scim
== Installing Input Method Engines ==
+
=== 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.
 
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 [http://www.scim-im.org/projects/imengines here]):
 
These are some of the examples (more can be found [http://www.scim-im.org/projects/imengines here]):
Line 41: Line 40:
 
  # pacman -S scim-hangul
 
  # pacman -S scim-hangul
  
= Configure SCIM =
+
== Configure SCIM ==
  
 
In order to work correctly, SCIM configuration needs three steps:
 
In order to work correctly, SCIM configuration needs three steps:
Line 71: Line 70:
 
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.
 
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 ==
+
=== Environment variables ===
  
 
Following environment variables have to be exported ''before'' executing scim:
 
Following environment variables have to be exported ''before'' executing scim:
Line 85: Line 84:
 
Note: the first environment variable conflicts with some (unusual) options like XMODIFIERS=urxvt.
 
Note: the first environment variable conflicts with some (unusual) options like XMODIFIERS=urxvt.
  
=== Note for amsn users ===
+
==== Note for amsn users ====
 
You must also export the following variable to be able to use scim input with amsn.
 
You must also export the following variable to be able to use scim input with amsn.
 
  export XIM_MODULE="scim -d"
 
  export XIM_MODULE="scim -d"
  
=== Note for GNOME, XFCE, LXDE ===
+
==== Note for GNOME, XFCE, LXDE ====
  
 
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:
 
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:
Line 95: Line 94:
 
  export QT_IM_MODULE="scim-bridge"
 
  export QT_IM_MODULE="scim-bridge"
  
=== Note for KDE3 ===
+
==== Note for KDE3 ====
  
 
For '''KDE''' you should either change QT IMM to '''xim''', or have ''scim-qtimm-cvs'' installed from AUR. Like this:
 
For '''KDE''' you should either change QT IMM to '''xim''', or have ''scim-qtimm-cvs'' installed from AUR. Like this:
Line 101: Line 100:
 
  export QT_IM_MODULE="xim"
 
  export QT_IM_MODULE="xim"
  
=== Note for GTK ===
+
=== 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.
 
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.
Line 112: Line 111:
 
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 don't need the first line.
 
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 don't need the first line.
  
== Locale-related files ==
+
=== 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 en_US.UTF-8 (or en_US.utf8), just skip this second step.
Line 130: Line 129:
 
(alternatively you can look at /etc/locale.gen).
 
(alternatively you can look at /etc/locale.gen).
  
=== Further troubleshooting with locales ===
+
==== 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.  
 
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.  
Line 141: Line 140:
  
  
== Executing SCIM ==
+
=== Executing SCIM ===
  
 
To execute SCIM, you ''usually'' can just execute (but see below):
 
To execute SCIM, you ''usually'' can just execute (but see below):
Line 153: Line 152:
 
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/autostart.sh (after environment variables and possibly after some sleep command).
 
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/autostart.sh (after environment variables and possibly after some sleep command).
  
=== Note for GNOME ===
+
==== 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:
 
In case you use GNOME as DE, the command above seems not to work as expected. Instead, you have to execute the following:
Line 163: Line 162:
 
Note: If you use the line  scim -f socket -c socket -d instead, the configuration of your SCIM will be unmodifiable.
 
Note: If you use the line  scim -f socket -c socket -d instead, the configuration of your SCIM will be unmodifiable.
  
=== Note for KDE ===
+
==== 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:
 
In case you use KDE as a DE, the command above seems not to work as expected. Instead, you have to execute the following:
Line 181: Line 180:
 
In any application, press ''ctrl+space'' to activate the input window.
 
In any application, press ''ctrl+space'' to activate the input window.
  
= Bugs =
+
== Bugs ==
  
== LWJGL (Lightweight Java Game Library) losing keyboard focus ==
+
=== LWJGL (Lightweight Java Game Library) losing keyboard focus ===
  
 
See [http://www.scim-im.org/forums#nabble-td2499750] and [http://ubuntuforums.org/showthread.php?t=1641861]. A "solution" is to kill scim and the application will accept keyboard input again.
 
See [http://www.scim-im.org/forums#nabble-td2499750] and [http://ubuntuforums.org/showthread.php?t=1641861]. A "solution" is to kill scim and the application will accept keyboard input again.
  
= Links =
+
== Links ==
  
 
[http://www.archlinux.org/news/166/ See the official news page for more details].
 
[http://www.archlinux.org/news/166/ See the official news page for more details].
  
 
[http://www.h4.dion.ne.jp/~apricots/scim-anthy/howto.html Complex SCIM Mandriva howto type Japanese]
 
[http://www.h4.dion.ne.jp/~apricots/scim-anthy/howto.html Complex SCIM Mandriva howto type Japanese]

Revision as of 12:23, 8 April 2011

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.

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end

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

Japanese:

# pacman -S scim-anthy

Korean:

# 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 XMODIFIERS=@im=SCIM
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.

 "/usr/lib/gtk-2.0/immodules/im-scim.so"
 "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 XMODIFIERS=@im=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.sh (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"

Note for GNOME, XFCE, LXDE

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 don't 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.

locale-gen


Executing SCIM

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

scim

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/autostart.sh (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.

Bugs

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.

Links

See the official news page for more details.

Complex SCIM Mandriva howto type Japanese