IBus

iBus is a next generation input framework for Linux / Unix OS that allows users to input multiple languages.

Packages
There are a variety of packages available, depending on which language(s) you wish to input.
 * app-i18n/ibus-antgfghy: Japanese (anthy)
 * app-i18n/ibus-chewing: Chinese (Traditional)
 * app-i18n/ibus-hangul: Korean
 * app-i18n/ibus-m17n: Many other languages (such as Thai), as well as extra input methods for Chinese (zhuyin), etc. (See column two @ m17n.org: List of Input Methods for a more complete list)
 * app-i18n/ibus-mozc: Japanese (mozc)
 * app-i18n/ibus-pinyin: Chinese (Simplified and Traditional)
 * app-i18n/ibus-skk: Japanese (anthy)
 * app-i18n/ibus-table: Chinese (support sZhengMa, WuBi, ErBi, CangJie, etc.)
 * app-i18n/ibus-table-array30: Chinese (array30)
 * app-i18n/ibus-table-cangjie: Chinese (cangjie)
 * app-i18n/ibus-table-cantonese: Chinese (Cantonese)
 * app-i18n/ibus-table-code: Chinese
 * app-i18n/ibus-table-cyrillic: Cyrillic (Russian, etc. - "Translit, Russian Traditional, Yawerty tables")
 * app-i18n/ibus-table-extraphrase: Chinese (... not clear ...)
 * app-i18n/ibus-table-latin: Latin
 * app-i18n/ibus-table-tv: Thai and Vietnamese
 * app-i18n/ibus-table-xingma: Chinese (xingma)
 * app-i18n/ibus-table-yinma: Chinese (yinma)
 * app-i18n/ibus-unikey: Vietnamese (unikey)

Setup
Install input method that you need as shown as below session. Such as Chewing method...

You should not emerge ibus directly, it'll be brought by input method dependencies

If you need use ibus for GTK-based application such as Firefox, please add a gtk use flag for install ibus.

Or just add flags you need into /etc/portage/package.use

Complete setup
Ensure that "input method starter" shortcut added into XDG startup and "IBus" is not.

Then run im-chooser and select "ibus" as input method. This will create /etc/X11/xinit/xinput.d/ibus.conf -> ~/.xinputrc symlink.

You can also easily customize configuration. For example you may want to remap capslock to F13.

Then place the following into /etc/X11/xinit/xinput.d/ibus-caps.conf:

source /etc/X11/xinit/xinput.d/ibus.conf

SHORT_DESC="IBus with Caps remapped"

xmodmap -e 'clear Lock' -e 'keycode 66 = F13'

Then use im-chooser to switch onto "IBus with Caps remapped"

After IM switch you should relogin into your session.