im-config vs. im-switch: switching input method for X

Osamu Aoki osamu at
Tue Jan 24 15:00:00 UTC 2012


(Excuse me for my slow start... Ubuntu list being closed list was my
excuse.  I hope my subscription is active by now.  I hope in future,
Ubuntu accepts signed mail from DD without subscription etc.)

I think Ubuntu is doing very good job to expand user base of FREE OS.

Since Ubuntu seems to have different support schedule for each release,
I thought it may be good idea to discuss side effects of my intended
actions on Debian packages related to Ubuntu main package here, so we
have least surprises to Ubuntu.

Summary of my wish:
 Basically im-config is redesigned and cleaned up version of im-switch.
 Currently, im-switch is Ubuntu main while im-config is Ubuntu universe.
 I wish to promote im-config to Ubuntu main while at appropriate time to
 move down im-switch to universe or drop im-switch in Ubuntu.

 If there is something I can do with my skill to help Ubuntu to move to
 im-config, let me know. (Pointer to the source VCS using im-switch is
 one thing.)

Main discussion and explanation:

I order to support keyboard input of CJK and many other non-latin
characters, we have input method (IM) systems.  I maintain both
im-switch (last 5 years) and im-config (1.5 years as upstream) in
Debian.  These are input method (IM) configuration helper scripts.  

These programs provide very similar functionalities.  Basically,
im-config is an updated package with a reimplementation and
simplification of internal structure.  This introduced some
incompatibilities and caused me to use different package names.  In most
cases, switching from im-switch to im-config requires no user action
other than installing and removing these packages.  It works almost
transparent for users by the default set-up.

For upcoming Debian release, we are doing the followings:

 * make all IM package to Recommends: im-config | im-switch (mostly done)
   So default install have im-config installed.
 * README.Debian of im-switch states followings            (done) 
    im-switch is deprecated.
    Please install im-config package for Wheezy.
    This package will be dropped completely for Wheezy+1.
 * probably move im-switch to oldlibs                     (not yet)
 * probably drop im-switch for Wheezy+1.
 * im-config is internationalized                         (done)
 * im-switch is not internationalized and stays so.

But these are some cases you need to watch out.

 * User who understood im-switch's manual configuration features
   needs to learn new but simpler im-config manual configuration
   features.  (This is the reason we do not drop in wheezy to enable
   softer transition in Debian)
 * Ubuntu provides "Language Support" GUI which uses im-switch.
   This may needs to be adjusted. (Ubuntu specific, I do not know the
   source ...)

As I understand, the main frontend of Ubuntu "Language Support" GUI is
language-selector.  I heard it will be the Region tab from
gnome-control-center soon. As long as we communicate well, we can change
the underlying implementation without much hassle.

Let me explain a bit more technical details of what these packages do as

When X starts, /etc/X11/Xsession runs scripts in /etc/X11/Xsession.d in
run-parts fashion.  im-switch and im-config drops their hook shell code
in /etc/X11/Xsession.d.  This hook script will do the followings:
 * run IM daemon
 * run GUI panel indication IM status on X
 * set and export environment variables to X clients
    export XMODIFIERS
    export GTK_IM_MODULE
    export QT_IM_MODULE
    export QT4_IM_MODULE

This hook script is configured by the im-switch or im-config command and
there are few notable differences:

The im-switch configuration result is specific to particular locale so
if user changes his locale setting, previous configuration may become
invalid.  It stores configuration in a symlink firms.

The im-config configuration result is agnostic about user's locale
setting (in default setting).  It stores configuration as a plain shell

Maybe, I should explain the rationale behind these design differences in
historical context.

There were 2 popular IM packages, SCIM and uim, when im-switch was
created.  There was a need to make both packages happily installed
together.  Now there are ibus, uim, fcitx, hime, scim, gcin, ... some
packages are active but some are about to be dropped.  They all are
supported by im-config and im-switch for wheezy.  

In order to enable all these packages installed together without
conflicts.  Since some of them comes with many plug-ins, GUI
configuration with helper dialogue is desirable, too.

The im-switch uses update-alternatives in its extreme by using --altdir
option,  the im-switch script was started by Muto-san but it has been
maintained by me.

The main problems of the im-switch script were:
 * over engineered.
 * very difficult to understand strange usage of update-alternatives
 * rely on update-alternatives command out put string
   --> No way for gettext
 * user customizations require deep understanding of how im-switch
   works.  I even forget what each variable does.  The only way is to
   read the whole source.
 * "im-switch -z en_GB -s scim_xim" is cryptic for average user.
 * Not too helpful selecting plug-ins.

When I looked at FEDORA 2 years ago, it started input method environment
via pure shell script embedding its guessing logic as simple "if ..." so
people can move from SCIM to IBUS easily.  (Their new im-chooser is much
more advanced.)

In order to keep im-switch functionality and but provide cleaner
framework for people to tweak, I made a simpler script im-config without
using update-alternatives but pure POSIX SHELL (Well, it still has
/bin/bash but I think it can be /bin/sh).

The main advantage of im-config is simplicity of its manual
configuration file:
/usr/bin/ibus-daemon --daemonize --xim

Its automatic configuration does more guessing/checking of installed
files.  It looks like:
# im-config(8) generated on Sat, 26 Jun 2010 11:41:39 +0900
run_im default
# im-config signiture: b4adf8baabbc92cf765f58e30f74c5e5  -

 * No new variables to remember.
 * No cryptic symlink firm in your home directory.
 * Very intuitive and hands free.
 * "im-config" command guide you properly in localized language what to
   install to get additional features.
 * dialogue supports both X(GTK) and non-X.
 * protection of user configuration.

!       Basic design of im-config

1. If an reasonable and single set of input method packages is
   installed, im-config activates it automatically for all users by
   default. (recommended situation)

2. If several reasonable sets of input method packages are installed,
   im-config activates the most reasonable one automatically for all
   users by default.

3. It provides a reasonably simple GUI configuration menu which is off
   for the system menu by the default.  Menu selected user configuration
   can override the system default.  Menu should normally show only
   available input methods on the system.

4. Its configuration files are intuitive and its contents can be manually
   overridden easily as a POSIX shell hook script.

5. Menu configuration system is smart enough to detect manual changes of
   configuration by editor and honors such changes.

6. POSIX shell script is internationalized via



More information about the Ubuntu-devel-discuss mailing list