On Mon, Sep 22, 2008 at 3:57 PM, Harshula <harshula@gmail.com> wrote:

> Hi,
> When you want to enable SCIM, do NOT add environment variables
> to /etc/environment anymore!
> The recommended way of enabling/disabling different input method
> infrastructures is to use im-switch:
> -----------------------------------------------------
> $ im-switch -h
> Input Method Switcher 0.3+debian1.10
> "im-switch" configures the input method to be automatically switched
> based
> on the locale (ll_CC) using Debian "update-alternatives" mechanism.
> When "im-switch" is invoked from root user, it sets system wide
> alternatives.
> Usage: im-switch [-v][-z ll_CC] -s inputmethodname
>           to set a specific input method for the language
>       im-switch [-v][-z ll_CC] -c
>           to set an input method for the language by menu

This usage of command with -c option is more useful than the first for users not yet familiar with available configuration files (i.e., "inputmethodname" )  which BTW are in /etc/X11/xinit/xinput.d/ . With -c option, all available configuration files are shown like multiple choices in a menu.


> I've updated http://sinhala.sourceforge.net/ accordingly.
> BTW, thanks to Sethu for telling me about im-switch back in early
> 2007! :-)

Thanks for thanking me. And I still have not written on im-switch as I had told you those days. It should more easier for me now because there has been no changes with im-switch framework between Hardy and Intrepid ubuntu releases  - so less to explain ;>) . May be in this posting I would cover substantial part of what a new user of it needs to know about it.

Couple of days back in a Live CD session of Ubuntu 8.10 (Intrepid) I used the repo for Hardy at http://sinhala.sourceforge.net/  (since the repo for Intrepid had not come out yet) to install "sinhala-gnu-linux". The repo for Hardy works alright for Intrepid.

But I found that it still writes in /etc/environment those environmental variables although, the step 5 of the guide tells the user to configure via im-switch framework. Configuration settings of IME written in /etc/environment always supersede initial setting or any subsequent switching by the im-switch framework. So the step of writing to /etc/environment by the the package installer still needs to be removed  if step 5 of the guide has to be actaully purposeful.

Then there is another plausible issue I wish to point out. The step 5 is :

im-switch -z all_ALL -s scim-immodule

When the quasi-locale "all_ALL" is used for ll_CC whether in system-wide or user's own configuration, it really means *all the rest* and *not each and every* locale.   To show the meaning by an hypothetical example, say an user (by his own volition or due to some other enabler program) has first got a configuration specific to a locale say "en_US" to inputmethodname "scim", and later executes the above im-switch configuration for "all_ALL". Then the two configuration links in user's "~/.xinput.d/" directory would be:

~/.xinput.d/en_US -> /etc/X11/xinit/xinput.d/scim
~/.xinput.d/all_ALL -> /etc/X11/xinit/xinput.d/scim-immodule

In this example the user would be using SCIM ime in every language locale session. But, as can be seen from the two configuration files (i.e., targets of the two links in the above):  

i) for en_US sessions,   as per "/etc/X11/xinit/xinput.d/scim" file, GTK_IM_MODULE and  QT_IM_MODULE are set to "xim" protocol.

ii). For sessions in all locales *other than* en_US,  as per "/etc/X11/xinit/xinput.d/scim-immodule" file, the two IM modules  are set to "scim" protocol in Hardy, Intrepid and Lenny; In cases of older  Gutsy and Etch, it is so for GTK_IM_MODULE but QT_IM_MODULE is not set to anything by scim-immodule file and user has to edit the file to un-comment the line for it to be set to "scim" if SCIM ime is to be used with QT based apps also. 

Thus an user in en_US sessions who is not aware of how im-switch works, would end up using scim with xim protocol for the two IM_MODULE variables and not what are intended by the setting  for the quasi-locale. Because user's configuration for specific locale supersedes the user's configuration for quasi-locale for sessions in the language environment of that locale. User's configuration for quasi locale is only valid for sessions in all other locales for which *no* specific locale configurations are set.

So in the above example case the user has to remove the configuration link for en_US (i.e.,  rm ~/.xinput.d/en_US )  to have settings of the "/etc/X11/xinit/xinput.d/scim-immodule" file to prevail for all locales.

An user having a priori know-how would know about the situation and if the enabler's preferred configuration is acceptable then the user would remove the earlier set specific locale setting.  

But novice users whose system has got such setting by some other enabler may not know the countervailing nature of the existing configuration.

And that is possible with Ubuntu releases. In Gnome DTE  with which I am familiar, there is a  GUI thingy called "Language Support" under "System"-."Administration"  which is not there in Debian Etch or Lenny. The command for it is "gnome-language-selector". In it, an user can enable or disable support for one or more languages and also set the default language. Further there is a choice for "Input Method"  to "Enable support to enter complex characters".  Screen shots of this can be seen under "Quick Setup" in  https://help.ubuntu.com/community/SCIM  (which community document seems to have been recently updated).

When that choice is applied, say, while the user is in "en_US.UTF-8" session then the following user's configuration gets set.

~/xinput.d/en_US -> -> /etc/X11/xinit/xinput.d/scim-bridge 

That is, it sets only for the specific locale in which the enabling choice was made. The  /etc/X11/xinit/xinput.d/scim-bridge  file consists of scripts to set GTK_IM_MODULE to "scim-bridge" if "scim-bridge-client-gtk" is installed and if not, to "xim". Similarly for QT_IM_MODULE depending on whether  "scim-bridge-client-qt" is installed or not. And on logout and login, SCIM would be working for that specific locale with those settings. Thus an user having no knowledge on how this has been effected, then following the guide step 5 in http://sinhala.sourceforge.net/ may not be conscious of the actuality that he is continuing to use SCIM with scim-bridge configuration settings whereas the intentions behind the Sinhala enabler is to use with scim protocols.

Perhaps the Sinhala enabler guide has to include an additional advisory to first remove all existing user's configurations (i.e., rm ~/.xinput.d/  ) and then set with "im-switch -z all_ALL -s scim-immodule" . 

Checking on the reverse order of first setting user's all_ALL to scim-immodule file and then enabling / disabling the choice for Input Method in Language selector   I found the following:

1. Starting without any user's configurations (i.e., ~/.xinput.d/ directory being empty) then using terminal command "im-switch -z all_ALL -s scim-immodule" followed by logout and re-login (all in en_US.UTF-8 locale) , I find that the choice for Input Method in Language Selector is ticked right. The ~/.xinput.d/ directory has only the following link:

all_ALL -> /etc/X11/xinit/xinput.d/scim-immodule.

2. Then when the choce is disabled in the Language Selector followed by re-login then en_US (i.e., the lang. of the logged in session)  gets set to "none". The two links appearing in ~/.xinput.d are:

all_ALL -> /etc/X11/xinit/xinput.d/scim-immodule
en_US -> /etc/X11/xinit/xinput.d/none

3. After the above, if the choice is enabled again in the Language Selector followed by re-login then for en_US the "none" setting gets removed and backs up (as when any switching is done with im-switch). i.e., "none" for en_US is negated and so "scim-immodule" for all_ALL setting prevails.  The two links appearing in ~/.xinput.d are:

all_ALL -> /etc/X11/xinit/xinput.d/scim-immodule
en_US.backup -> /etc/X11/xinit/xinput.d/none

So when there is already a user's configuration that is effective on the lang locale of the logged in session, the input method choice  in Language Selector does not alter user's choice for the configuration file in force. But  disabling then the input method choice in Language  Selector turns off IME for the locale logged in. Re-enabling from there does not alter user's own configuration for all_ALL.

So users of the Sinhala enabler may have to be given an additional advisory not to un-tick the choice  in Language Selector if visited any time after following the guide.

All these because of that rather dumb GUI black box type facility in Language Selector which in my opinion hides the elegance of the im-switch framework used from a terminal.