From Fedora Project Wiki

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.

Process Overview

File:AkiraTagoh IMSettings IMSettings small.png [[[Image:AkiraTagoh_IMSettings_IMSettings.png]] full size]

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 im-info-daemon 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 xim.conf 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.


D-Bus APIs

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 im-settings-daemon.

  • com.redhat.imsettings.StartIM(in STRING lang, in STRING im_name, in BOOLEAN update_xinputrc, out BOOLEAN ret)

a method to bring up the necessary processes for im_name input method with lang language if necessary. also send a request to change the settings for GTK+ say. if update_xinputrc is FALSE, .xinputrc won't be modified after invoking this method.

  • com.redhat.imsettings.StopIM(in STRING im_name, in BOOLEAN update_xinputrc, in BOOLEAN force, out BOOLEAN ret)

a method to stop the processes for im_name input method. it may be failed due to any reasons. it won't changes the settings completely then. in that case, you can give force option to do all the procedures anyway. if update_xinputrc is FALSE, .xinputrc won't be modified after invoking this method, otherwise it points to none.

com.redhat.imsettings.IMInfo

Information provider interface. This is to communicate im-info-daemon.

  • com.redhat.imsettings.IMInfo.GetList(in STRING lang, out ARRAYofSTRING ret)

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.GetIMModuleName(in STRING im_name, in UINT type, out STRING ret)

a method to get various immodule name, including XIM. which one you want could be specified by type. currently IMSETTINGS_IMM_GTK for GTK+ immodule, IMSETTINGS_IMM_QT for Qt immodule and IMSETTINGS_IMM_XIM is supported.

  • com.redhat.imsettings.IMInfo.GetXimProgram(in STRING im_name, out STRING prog_name, out STRING prog_args)

a method to get the XIM server program and its command line options for im_name input method.

  • com.redhat.imsettings.IMInfo.GetPreferencesProgram(in STRING im_name, out STRING prog_name, out STRING prog_args)

a method to get the preferences program and its command line options for im_name input method.

  • com.redhat.imsettings.IMInfo.GetAuxiliaryProgram(in STRING im_name, out STRING prog_name, out STRING prog_args)

a method to get the auxiliary program and its command line options for im_name input method. this may be used to bring up the kind of toolbar etc.

  • com.redhat.imsettings.IMInfo.GetShortDescription(in STRING im_name, out STRING ret)

a method to get a short description for im_name input method.

  • com.redhat.imsettings.IMInfo.GetLongDescription(in STRING im_name, out STRING ret)

a method to get a long description for im_name input method.

  • com.redhat.imsettings.IMInfo.IsSystemDefault(in STRING im_name, out BOOLEAN ret)

a method to see if im_name input method is recommended for your system.

  • com.redhat.imsettings.IMInfo.IsUserDefault(in STRING im_name, out BOOLEAN ret)

a method to see if im_name input method is brought up by default for your desktop session.

  • com.redhat.imsettings.IMInfo.IsXim(in STRING im_name, out BOOLEAN ret)

a method to see if im_name input method is XIM or not.

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 gconf-im-settings-daemon.

  • com.redhat.imsettings.GConf.ChangeTo(in STRING im_name, out BOOLEAN ret)

a method to change the GTK+ immodule to im_name immodule.


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.