[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[proposal] to split individual IM config out of xinitrc xinput script



In order to improve the maintainability of the xinput script
in xinitrc and to make adding new Input Methods (IMs) easier
in the future, Akira Tagoh and I recently came up with the
idea to split all the individual IM code out of xinput and
put it into separate config scriptlets that would be owned
and maintained by the individual IM packages.

The idea is basically to replace all the IM specific code in
xinput by something like this:

  lang_region=$(echo $tmplang | sed -e 's/\..*//')
  XINPUTDIR=/etc/X11/xinit/xinput.d
  if [ -z "$XIM" ]; then
    if [ -r ${XINPUTDIR}/$(LANG) ]; then
      . ${XINPUTDIR}/$(LANG)
    elif [ -r ${XINPUTDIR}/$(lang_region) ]; then
      . ${XINPUTDIR}/$(lang_region)
    fi
  elif [ -r ${XINPUTDIR}/$(XIM) ]; then
    . ${XINPUTDIR}/$(XIM)
  fi

where $XINPUTDIR would contain scriptlets installed with
alternatives by the individual IM packages (htt, chinput,
xcin, nabi, kinput2, skkinput, etc) and alternatives
symlinks for each locale through /etc/alternatives to the
default IM for it.  For example:

  /etc/X11/xinit/xinput.d/hi_IN -> /etc/alternatives/xinput-hi_IN
  /etc/X11/xinit/xinput.d/ja_JP -> /etc/alternatives/xinput-ja_JP
  /etc/X11/xinit/xinput.d/ko_KO -> /etc/alternatives/xinput-ko_KO
  /etc/X11/xinit/xinput.d/zh_CN -> /etc/alternatives/xinput-zh_CN
  /etc/X11/xinit/xinput.d/zh_TW -> /etc/alternatives/xinput-zh_TW

[It is not sure whether it better to support symlinks for
both ll_CC.ENCODING and ll_CC separately or not.  Perhaps
only ll_CC or even just ll is sufficient?]

and then for example there would be symlinks like

  /etc/alternatives/xinput-hi_IN -> /etc/X11/xinit/xinput.d/htt
  /etc/alternatives/xinput-ja_JP -> /etc/X11/xinit/xinput.d/kinput2-canna
  /etc/alternatives/xinput-ko_KO -> /etc/X11/xinit/xinput.d/nabi
  /etc/alternatives/xinput-zh_CN -> /etc/X11/xinit/xinput.d/htt
  /etc/alternatives/xinput-zh_TW -> /etc/X11/xinit/xinput.d/xcin

[For FC the default IM would actually be htt (if installed)
for all these locale, but I just put in various IMs here to
illustrate.]

See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=119785
for more details and comments.  Unfortunately it is getting
a bit late now for FC2, so this idea may have to wait for
FC3.

The only weakness of this compared to the current xinput
setup that I can think of is that it doesn't allow for any
fallbacks: eg if htt is running use it otherwise use kinput2
with Canna say instead.  But in practice people don't
usually switch IM all the time, and the flexibility gained
outweighs this small loss.  Also users can still easily
override the IM configuration by setting XIM (and optionally
also XIM_PROG and XIM_ARGS) in their ~/.i18n" file or
system-wide in "/etc/i18n".

Comments and feedback on the scheme and design are most welcome.

Cheers, Jens



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]