AkiraTagoh/IMSettings

What's IMSettings?
IMSettings is a framework that delivers input method settings and applies changes immediately without needing to restart applications and the desktop.

Background
Input Method is used to input some dozens of characters that can't be represented with ASCII characters, with some framework, such as XIM and SCIM via GTK+/Qt immodule. particularly which to handle languages that is a bit complex to do the same thing with the keyboard layout. In the past, those frameworks has been applied through the environment variables, such as XMODIFIERS and GTK_IM_MODULE. and can't be influenced immediately and can't be without restarting the desktop because of its nature - it's being inherited from the parent process unless it's being brought up with the obvious thing from the terminal say. Also, there are no such framework to bring up the necessary process at the runtime - of course anyone could runs it manually though, it's totally out of focus on this project.

Features

 * Provide the input method's information through IMSettings
 * Provide the D-Bus service to start/stop an process of input method
 * Provide the way to apply an input method to applications immediately

Scope
IMSettings may helps when...


 * you may want to disable IM entirely to use features on any applications, which actually can't use with IM because of the key conflicting.
 * you may try another IM without closing current desktop session.
 * someone may want to borrow your desktop temporarily, who uses different IM.
 * the appropriate IMs needs to be installed by default regardless of you use, such as Live image.

Information files for Input Method
To make Input Methods available from IMSettings, every Input Methods that hopes so has to have the information file to let IMSettings know. it's usually put under /etc/X11/xinit/xinput.d/ in Fedora. those has to have .conf as suffix. otherwise  will just ignores them. however you shouldn't have .conf for XIM server say, because it basically just works for the specific locale only. and  will provide such information alternatively according to current locale.

Available Parameters
They are described as the shell environment variables like FOO=BAR.

AUXILIARY_PROGRAM:: An optional program that may want to bring up for Input Method. such as the panel and the toolbar.

AUXILIARY_ARGS:: A command line options for AUXILIARY_PROGRAM.

GTK_IM_MODULE:: GTK+ immodule name that want to use.

IMSETTINGS_IGNORE_ME:: A parameter to hide Input Method from the inventory. you however can still take an action against such Input Method.

LONG_DESC:: An optional long description to explain what this Input Method is.

PREFERENCE_PROGRAM:: An optional program that set up Input Method. IMSettings itself do nothing on this parameter. but other tools, such as im-chooser will take an action for that.

PREFERENCE_ARGS:: A command line options for PREFERENCE_PROGRAM.

QT_IM_MODULE:: Qt immodule name that want to use.

SHORT_DESC:: An optional short description to explain What this Input Method is. this variable is also used for the key to do something on IMSettings. e.g. to start/stop Input Method and get the information etc.

XIM:: This variable is used for XIM. actually it looks like XMODIFIERS=@IM=$XIM.

XIM_PROGRAM:: A XIM server be brought up to communicate through XIM protocol.

XIM_ARGS:: A command line options for XIM_PROGRAM.

com.redhat.imsettings
Core interface for IMSettings. this interface could be supposed to be invoked from other applications. but other interface may not. This interface is to communicate.

a method to bring up the necessary processes for  input method with   language if necessary. also send a request to change the settings for GTK+ say. if  is , .xinputrc won't be modified after invoking this method.
 * com.redhat.imsettings.StartIM(in STRING, in STRING  , in BOOLEAN  , out BOOLEAN  )

a method to stop the processes for  input method. it may be failed due to any reasons. it won't changes the settings completely then. in that case, you can give  option to do all the procedures anyway. if  is , .xinputrc won't be modified after invoking this method, otherwise it points to.
 * com.redhat.imsettings.StopIM(in STRING, in BOOLEAN  , in BOOLEAN  , out BOOLEAN  )

com.redhat.imsettings.IMInfo
Information provider interface. This is to communicate.

a method to get the input methods list that currently is available on the system. each items could be usually used as the key to do something through IMSettings for other methods.
 * com.redhat.imsettings.IMInfo.Get, out ARRAYofSTRING )

a method to get various immodule name, including XIM. which one you want could be specified by. currently  for GTK+ immodule,   for Qt immodule and   is supported.
 * com.redhat.imsettings.IMInfo.GetIMModuleName(in STRING, in UINT  , out STRING  )

a method to get the XIM server program and its command line options for  input method.
 * com.redhat.imsettings.IMInfo.Get Program(in STRING, out STRING  , out STRING  )

a method to get the preferences program and its command line options for  input method.
 * com.redhat.imsettings.IMInfo.Get Program(in STRING, out STRING  , out STRING  )

a method to get the auxiliary program and its command line options for  input method. this may be used to bring up the kind of toolbar etc.
 * com.redhat.imsettings.IMInfo.Get Program(in STRING, out STRING  , out STRING  )

a method to get a short description for  input method.
 * com.redhat.imsettings.IMInfo.Get Description(in STRING, out STRING  )

a method to get a long description for  input method.
 * com.redhat.imsettings.IMInfo.Get Description(in STRING, out STRING  )

a method to see if  input method is recommended for your system.
 * com.redhat.imsettings.IMInfo.Is Default(in STRING, out BOOLEAN  )

a method to see if  input method is brought up by default for your desktop session.
 * com.redhat.imsettings.IMInfo.Is Default(in STRING, out BOOLEAN  )

a method to see if  input method is XIM or not.
 * com.redhat.imsettings.IMInfo.Is, out BOOLEAN )

com.redhat.imsettings.GConf
XSETTINGS for GTK+ interface. this assumes that gnome-settings-daemon or similar XSETTINGS manager is running, which deals with XSETTINGS through GConf. Usually you don't need to invoke methods on this interface. This is to communicate.

a method to change the GTK+ immodule to  immodule.
 * com.redhat.imsettings.GConf.Change, out BOOLEAN )

Comments

 * MatthiasClasen: Akira, that is a fine start, thanks. Here are some of the questions I am left with after reading it:


 * What is the problem that you are trying to solve ? I guess a good problem statement would be "changing input method may require a relogin". Might also be good to give some background as to why this is the case.


 * AkiraTagoh: Thanks for the comment. I've updated above.


 * What do you hope to achieve ? I assume the list of goals would be something like: changing input methods in im-chooser has immediate effect, the current input method is remembered over logout/login, and the current input method is shared across toolkits and desktops.


 * AkiraTagoh: exactly.


 * How does IMSettings solve this, conceptually ?


 * AkiraTagoh: by delivering the change through XSETTINGS through D-Bus. which input method is currently using is no changes in im-chooser. im-chooser still takes the same way supported in the previous release. will describe how it's kept.


 * The interfaces by themselves are somewhat interesting, but what I'd really like to see is a diagram that explains how the multiple programs (im-chooser, im-settings-daemon, im-info-daemon, gconf-im-settings-daemon) communicate, what process implements what interface, which processes run all the time, if any, which are activated by dbus on demand.


 * AkiraTagoh: Updated above.


 * Random comment: I'd loose the "Dbus" from the interface names, it adds nothing and looking around, doesn't seem to be common practise.


 * AkiraTagoh: Fixed in svn and updated the above document too.