IBus

From ArchWiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

IBus (Intelligent Input Bus) is an input method framework, a type of application that allows for easily switching between different keyboard layouts. When combined with an input method editor, it also allows for typing non-Latin characters using a keyboard that does not natively support them.

Installation

Install the ibus package.

Additionally, see Input method#List of available input method editors for a comprehensive list of available input method editors.

Integration

Set at least the following environment variables:

/etc/environment
GTK_IM_MODULE=ibus
QT_IM_MODULE=ibus
XMODIFIERS=@im=ibus
Note: GNOME has integrated IBus since version 3.6 and makes use of it by default, so if you use it as your desktop environment, you may skip the next part.

To launch IBus on user login, create an autostart entry with the following command:

ibus-daemon -drxR

On the next login IBus will start along with the user session.

Tip:
  • KDE comes with a plasmoid called Input Method Panel that can act as an IBus frontend and can possibly provide a better integrated experience. To launch IBus with Input Method Panel, use the --panel=/usr/lib/kimpanel-ibus-panel option with the ibus-daemon command above. To configure the Input Method Panel widget, see the KDE UserBase Wiki and KDE#Widgets for details.
  • Additional functionality on KDE may be provided by kimtoy. However, the project has been archived and may not work as expected.

Configuration

See Locale for help with adding non-Latin language support to your system.

See Fonts#Non-latin scripts for a non-exhaustive list of available non-Latin fonts.

GNOME

GNOME uses IBus by default, so you can simply go to Settings > Keyboard > Input Sources and add a keyboard layout for the language of your choice.

Other desktop environments

To launch the IBus preferences window, you can:

  • Right-click on its tray icon and select Preferences, or
  • Find and launch the GUI application IBus Preferences, or
  • Run the command ibus-setup in a terminal

The points of interest here are the keyboard shortcut for Next input method (which is the one you will want to use instead of the default shortcut provided by your desktop environment) and the Input Method tab where you can add or remove the different keyboard layouts (which is where you will want to do this instead of your desktop environment's default layout manager).

Tips and tricks

Emoji input

IBus supports the input of emoji icons. Type Ctrl+. and you will see the input prompt change to an underlined e character. You can then type the symbol or name of the emoji you want (e.g. :) or face) and press Space to render it. If you are satisfied with the result press Enter to submit it and exit emoji input mode, or press Space for a second time to open a dialog where you can further customize your desired emoji.

See ibus-emoji(7) for more information.

Unicode input

IBus supports the input of complex Unicode characters. Type Ctrl+Shift+u and you will see the input prompt change to an underlined u character. You can then type the code of the Unicode character you want and press Space or Enter to render and submit it.

Tray icon color

By default, IBus uses a dark blue color to display the language symbol of the currently active layout (e.g. EN). The color value is stored in a gsettings schema, so if you wish to change it you can run the following command:

$ gsettings set org.freedesktop.ibus.panel xkb-icon-rgba 'COLOR'

The string 'COLOR' should conform to the following guidelines:

The RGBA value can be 1. a color name from X11, 2. a hex value in form '#rrggbb' where 'r', 'g' and 'b' are hex digits of the red, green, and blue, 3. a RGB color in form 'rgb(r,g,b)' or 4. a RGBA color in form 'rgba(r,g,b,a)' where 'r', 'g', and 'b' are either integers in the range 0 to 255 or percentage values in the range 0% to 100%, and 'a' is a floating point value in the range 0 to 1 of the alpha.
Tip: You can also use dconf-editor to edit the gsettings schema in a more user-friendly way.
Note: This doesn’t apply to either GNOME or KDE with KDE Input Method Panel, because they both provide their own icons for IBus.

Layout switcher display delay

When pressing the Next input method hotkey, IBus displays a small dialog to signify the layout switch. By default this dialog is displayed 400ms after pressing the key, but this value can be changed by the user, with some interesting choices being '0' to display the dialog immediately without any delay, or a negative value (e.g. '-1') to switch the layouts without showing the window at all (which may be useful if you only use two layouts and simply switch from one to the other).

The value is stored in a gsettings schema, so if you wish to change it you can run the following command:

$ gsettings set org.freedesktop.ibus.general switcher-delay-time 'VALUE'

To show the currently stored value, run the following command:

$ gsettings get org.freedesktop.ibus.general switcher-delay-time

The string 'VALUE' should conform to the following guidelines:

Set popup delay milliseconds to show IME switcher window. The default is 400. 0 = Show the window immediately. 0 < Delay milliseconds. 0 > Do not show the window and switch prev/next engines.
Tip: You can also use dconf-editor to edit the gsettings schema in a more user-friendly way.

Using modifier key combinations to switch layouts

For some reason, the IBus preferences GUI will not let you use a subset of modifier key combinations (e.g. Alt+Shift_R) as the layout switching hotkey. However, IBus stores the hotkey as a string in a gsettings schema, so you can still use such combinations by directly editing that string:

$ gsettings set org.freedesktop.ibus.general.hotkey triggers "['VALUE']"

The string 'VALUE' should be any valid modifier key combination written in a format that IBus recognizes, e.g. <Alt>Shift_R.

Tip: You can also use dconf-editor to edit the gsettings schema in a more user-friendly way.

Firejail

Tango-edit-cut.pngThis section is being considered for removal.Tango-edit-cut.png

Reason: Is this still valid? Reading the Note makes it seem like the workaround is no longer needed and IBus works natively with sandboxed applications, without needing to use Xim. May I ask whoever wrote this additional Note to share their thoughts on this in the Talk page? (Discuss in Talk:IBus)
Note: As of Jul 2020, Firejail introduced DBus filtering. It is now possible to use the --dbus-user.own=org.freedesktop.IBus parameter to let Firefox access IBus.

Sandboxed programs may not work with some IBus input methods due to the input socket being invisible to the sandbox[1][2][3]. For example, Firefox sandboxed with Firejail may not register inputs given by IBus Anthy.

A workaround is to make IBus use XIM by changing the exported environment variables (see #Integration) like so:

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

rxvt-unicode

For rxvt-unicode to work correctly with IBus, you may need to add the following lines to ~/.Xresources:

URxvt.inputMethod: ibus
URxvt.preeditType: OverTheSpot

Troubleshooting

Missing packages due to pyenv

If using pyenv to manage python versions and configuration, ibus dependencies may not be installed on the set global python version. This can happen if the global version is not the one managed by the system (to which dependencies that ibus depends on, such as gi are installed). This may result in a running but non-functional ibus setup (ibus is in the system tray, but preferences can not be opened, etc). One way to verify this issue is to attempt to run ibus-setup and see if any missing dependency errors arise.

To fix this issue, change your pyenv global version to the system version:

pyenv global system

Settings removed after restart

If you find your settings are being removed consistently after restart (input methods being reverted), you can confirm the engines set to be preloaded and the order in which they will be loaded:

$ gsettings get org.freedesktop.ibus.general preload-engines
['xkb:us::eng']
$ gsettings get org.freedesktop.ibus.general engines-order
['xkb:us::eng', 'anthy']

To ensure anthy gets loaded in this case, add it to the org.freedesktop.ibus.preload-engines list:

$ gsettings set org.freedesktop.ibus.general preload-engines "['xkb:us::eng', 'anthy']"

Changes your changes should be reflected immediately, and should persist across restarts.

See also