IBus

From ArchWiki
Jump to navigation Jump to search

IBus (Intelligent Input Bus) is an input method framework, a system for entering non-Latin characters.

Installation

Install the ibus package.

Input method engines

At least one input method is required, corresponding to the language desired. Available input methods include:

Chinese

  • ibus-pinyin - Intelligent Chinese Phonetic IME for Hanyu pinyin and Zhuyin (Bopomofo) users. Designed by IBus main author and has many advance features such as English spell checking. Package currently not maintained and partly broken with latest ibus base. Use ibus-libpinyin instead.
  • ibus-rime - Powerful and smart input method for a wide range of Chinese input methods, based on the Rime IME project.
  • ibus-chewing - Intelligent Chinese Phonetic IME for Zhuyin (Bopomofo) users, based on libchewing.
  • ibus-cangjieAUR - Chinese IME for Cangjie3, Cangjie3, and Quick based on libcangjieAUR and python-pycangjieAUR.

Japanese

Vietnamese

  • ibus-bambooAUR - Vietnamese IME, based on Bamboo engine.
  • ibus-bogoAUR - Vietnamese IME, based on Bogo. (discontinued)
  • ibus-unikey - IME for typing Vietnamese characters. (discontinued)

There are several other vietnamese IME with ibus-m17n and Viqr with ibus-table, support VIQR, VNI, VPS, VISCII, BK HCM1, BK HCM2.

Others

  • ibus-hangul - Korean IME, based on libhangul. Manage several dubeolsik and sebeolsik keyboards variants and ahnmatae keyboard. Can be switched in hanja mode both with hanja key and F9 by default.
  • ibus-table - IME that accommodates table-based IMs.
  • ibus-m17n - M17n IME which allows input of many languages using the input methods from m17n-db.
  • ibus-kmflAUR - Linux port of Keyman input method for Windows which supports over 1,000 languages, such as complex scripts, languages of minorities, and IPA symbols. Only part of them is available in KMFL as it can work with uncompiled layout description only (*.kmn files).

To see all available input methods:

$ pacman -Ss '^ibus-*'

Others packages are also available in the AUR.

Initial setup

Now, run $ ibus-setup. The daemon will be initialized and provide the following message:

IBus has been started! If you cannot use IBus, please add below lines in ~/.bashrc, and relogin your desktop.
export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Suggested values might be wrong (chromium and firefox do not work with them for me). Using
export GTK_IM_MODULE=xim
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=xim
works for me. Upstream ticket (Discuss in Talk:IBus#)

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Another suggestion from a LXDM user. Adding these lines to /etc/profile
export GTK_IM_MODULE=ibus
export QT4_IM_MODULE=xim
export QT_IM_MODULE=xim
export XMODIFIERS=@im=ibus
worked for me. (Discuss in Talk:IBus#)
Note:
  • Although IBus uses a daemon, it is not the sort of daemon managed by systemd: it runs as an ordinary user and will be started upon login.
  • If, however, IBus is not autostarted upon login, then move the “export …” lines above to either
    • ~/.xprofile instead and append this line to the same file: ibus-daemon -drx, or
    • ~/.xinitrc and append this line to the same file: ibus-daemon -drx.
The most viable option depends on the active Window manager, see also xprofile and xinitrc.
  • Another potential option is adding ibus-daemon -drx after the export ... lines in ~/.bashrc.

Next, a configuration screen will appear. It can be accessed whenever IBus is running by right-clicking the icon in the system tray and choosing Preferences. See Configuration.

Integration

If you want IBus to show an indicator for desktop environments who don’t provide an applet, launch it with this command:

 ibus-daemon -drx --panel /usr/lib/ibus/ibus-ui-gtk3

GNOME

GNOME integrates with IBus[1], so it should only be necessary to install the package specific to the language being utilized. To enable input, add it to the Input Sources section of the Region & Language settings. After you add your input sources (at least 2), GNOME will show the input switcher icon in the tray. If you do not find your appropriate input source when trying to add your input sources, most likely you have not done locale-gen for that locale. The default keyboard shortcut to switch to the next input method in GNOME is Super+space; disregard the next input method shortcut set in ibus-setup.

KDE

KDE can integrate with IBus with kimtoy. You then need to launch IBus this way:

 ibus-daemon -drx --panel=/usr/lib/kimpanel-ibus-panel

Configuration

IBus

Note: You need to have east Asian fonts installed if you want to enter Chinese, Japanese, Korean or Vietnamese characters.

The default General settings should be fine, but go to Input Methods and select your input method(s) in the drop down box, then press Add. You can use multiple input methods if you wish. Once IBus is set up, you can press Super+space to use it (multiple times to cycle through available input methods). IBus will remember which input method you are using in each window, so you will have to reactivate it for each new window. You can override this behavior by right clicking the system tray icon, selecting Preferences, and going to the Advanced tab.

Note: By default, IBus overrides your Xmodmap setting. You can disable this feature by enabling "Use system keyboard layout" option in Preference -> Advanced.

Ibus-rime

If you have decided to use the great ibus-rime IME, check out Rime IME for some help to configure it.

Entering Special Characters—The Compose Input Method

To type special characters, XKB supports compose key sequences. To fulfil this function, IBus supports an input method that is permanently in Compose mode. Instead of hitting a compose key, then typing out the compose sequence, the user switches to the Compose input method (by default using super-space (a.k.a. win-space)), types the compose sequence, then switches back to the previous method. In Archlinux, the Compose input method is not installed by default. To use it, install ibus-table-othersAUR from the AUR, restart IBus, then look for it in the list of input methods under 'other' at the bottom.

For entering mathematical symbols, ibus-table-othersAUR also contains a LaTeX Input Method (which maps LaTeX commands such as \infty to the equivalent Unicode characters ) and a mathwriter Input Method.

Tips and tricks

Pinyin usage

When using ibus-pinyin,

  • First type the pinyin (sans tones) for the characters you wish to enter.
  • Press Up and Down repeatedly to select a character (going on to the next page if necessary).
  • Press Space to use a character.
  • You can also use PageUp or PageDown to scroll pages, and use the number keys 1-5 to select the character you need.
  • You can enter multiple characters that form a word or phrase at a time (such as "zhongwen" to enter "中文"). ibus-pinyin will remember which characters you type most frequently and over time make suggestions that are more tuned to your typing profile.

Troubleshooting

Plasma 5

Some applications may not accept non-"direct input" text (e.g. Japanese and Chinese) from Mozc using IBus. In order to resolve this problem add

export QT_IM_MODULE=ibus

to ~/.xprofile and restart your X user session.

Kimpanel

IBus main interface is currently only available in GTK, but Kimpanel provides a native Qt/KDE input interface. Kimpanel is bundled with Plasma 5, but IBus needs to be launched as following to be able to communicate with the panel

$ ibus-daemon --panel=/usr/lib/kimpanel-ibus-panel

To get a menu entry for launching ibus this way, save the following file to ~/.local/share/applications/ibus-kimpanel.desktop:

[Desktop Entry]
Encoding=UTF-8
Name=IBus (KIMPanel)
GenericName=Input Method Framework
Comment=Start IBus Input Method Framework
Exec=ibus-daemon --panel=/usr/lib/kimpanel-ibus-panel
Icon=ibus
Terminal=false
Type=Application
Categories=System;Utility;
X-GNOME-Autostart-Phase=Applications
X-GNOME-AutoRestart=false
X-GNOME-Autostart-Notify=true
X-KDE-autostart-after=panel

Then you can either let KDE autostart ibus, or set it as the input method application in Kimpanel, and manually click on the kimpanel icon to start it. In either case, choose Utility/Ibus (Kimpanel) in the Choose Application dialog.

Finally, add the input panel widget to show the panel.

rxvt-unicode

If anyone has any issues with IBus and rxvt-unicode, the following steps should solve it.

Add the following to your ~/.Xresources (possibly not required, first try without):

URxvt.inputMethod: ibus
URxvt.preeditType: OverTheSpot

And start IBus with:

$ ibus-daemon --xim

If you start ibus-daemon automatically (e.g. in ~/.xinitrc or ~/.xsession) but used to use ibus-daemon & without the --xim option, make sure to kill the existing process before testing the new command.

GTK applications

Some users have had problems using Input Methods with GTK applications, because it seems that the gtk.immodules file cannot be found. Adding:

export GTK_IM_MODULE_FILE=/etc/gtk-2.0/gtk.immodules

for GTK 2, or:

export GTK_IM_MODULE_FILE=/usr/lib/gtk-3.0/3.0.0/immodules.cache

for GTK 3, in addition to the three lines above in your $HOME/.bashrc seems to fix the problem.

Note: If you set it to GTK 2, then you cannot use GTK 3 applications like gedit, if you set it to GTK 3, then you cannot use GTK 2 applications like Xfce.

Chinese input

If you encounter problems when using Chinese input, check your locale setting. For example in Hong Kong, export LANG=zh_HK.utf8.

Note: There are large revisions after IBus 1.4, you might not be able to input Chinese words with ibus-pinyin or ibus-sunpinyin, which are written in C. So the solution is to install ibus-libpinyin.

To start ibus with GNOME, add this in ~/.profile and restart the GNOME.

export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus
ibus-daemon -d -x

Chinese users can refer to this page for detailed solution concerning this bug.

LibreOffice

If IBus does load but does not see LibreOffice as an input window, add this line to ~/.bashrc:

export XMODIFIERS=@im=ibus

And then, you need to start ibus with --xim -d, for example, add this line to ~/.xinitrc:

ibus-daemon --xim -d

But the horrible thing is that you need to start LibreOffice in terminal.

If you are using KDE and the above does not work, install libreoffice-still and add this line to ~/.xprofile if you do not mind running LibreOffice in GTK 2 mode:

export OOO_FORCE_DESKTOP="gnome"

That will make IBus work with LibreOffice, and you can start LibreOffice from anywhere, not just the terminal.

Non US keyboards

If Ibus does not let you write in a given language, let's say Chinese, with a different keyboard layout other than US, then you need to tell it which one to use.

Each input method specifies its desired input layout in an XML configuration file in /usr/share/ibus/component/<method_name>.xml. Setting the <layout> tag to the desired value will make the ibus use that layout. With the special value default, ibus will use whatever is the default layout configured on the system.

Tango-inaccurate.pngThe factual accuracy of this article or section is disputed.Tango-inaccurate.png

Reason: Undone on package upgrades (Discuss in Talk:IBus#)


You need to change /usr/share/ibus/component/<method_name>.xml and change the <layout> tag to the expected keyboard layout.

Use xinitrc to export

If you still can't get it to work, try to place these lines in ~/.xinitrc.

 export GTK_IM_MODULE=ibus
 export XMODIFIERS=@im=ibus
 export QT_IM_MODULE=ibus

This was tested in Awesome, without login manager.

Rescue from an iBus crash

Since around fall 2018, iBus is less stable and sometimes crash. To relaunch it without killing the session:

  • If the keyboard is not in latin input method, go to a terminal (ctrl+alt+F2), login with the same user and type
  • ibus-daemon -r &

Go back in the X11 session (ctrl+alt+f7), and type the exact same sentence in a terminal.

  • If the keyboard is in a latin input method, launch a terminal and type :
ibus-terminal -r &

The ending '&' is very important, else it will broke input when you stop it.

ibus-m17n

In the specific case of ibus-m17n, a helper, /usr/lib/ibus/ibus-engine-m17n, generates the necessary XML at runtime. With version 1.3.4-4 of the package, this unfortunately uses us as the layout without a possibility of override. Fortunately, this was changed to default a few commits later in Git, but no new release was made since then. To remediate the issue, a Git-master version of the package is available from AUR, which works nicely.

English international AltGr

If you want to use AltGr as compose key for the english keyboard, choose English international AltGr in the ibus-setup instead of 'English'.

Trouble with Japanese

If you have trouble with Japanese input try to generate the locales with uncommenting ja_JP.UTF-8 UTF-8 in the /etc/locale.gen file and then run locale-gen.

See also