Input Japanese using ibus

From ArchWiki
Jump to navigation Jump to search

This page explains how to get the Japanese input to work using IBus.

If you use SCIM, see Smart Common Input Method platform.

If you use Uim, see Input Japanese using uim.

Installation

You need the following packages to input Japanese.

  • Japanese fonts
  • Japanese input method (Kana to Kanji conversion engine)
  • Input method framework: ibus

Japanese fonts

see also Fonts, Font configuration and Localization/Japanese for configuration or more detail.

Recommended Japanese fonts are as follows.

Sans-serif

Open-source OTF fonts developed by Adobe.

Serif and Sans-serif

An open source OTF font set including sans-serif (Gothic) and serif (Mincho) glyphs provided by Information-technology Promotion Agency, Japan (IPA).

If you want to show 2channel Shift JIS art properly, use the following fonts:

ibus

Install the ibus package.

Input method

Anthy

Anthy is one of the most popular Japanese input methods in the open source world.

Install ibus-anthy from the official repositories.

Mozc

See Mozc.

Mozc is a Japanese Input Method Editor (IME) designed for multi-platform such as Chromium OS, Windows, Mac and Linux which originates from Google Japanese Input.

Install ibus-mozcAUR which is available on AUR.

Settings

Environment variables

Add the following to ~/.xprofile, ~/.xinitrc or ~/.xsessionrc:

export GTK_IM_MODULE='ibus'
export QT_IM_MODULE='ibus'
export XMODIFIERS='@im=ibus'
ibus-daemon -dr
Note: The variables should be exported before starting your desktop environment, i.e. before "exec startxfce4" or similar. See below if you are using systemd to manage your X session.

Using systemd

If you are using systemd to manage your X session, you will need to set the environment variables in your systemd session rather than an init script.

~/.config/systemd/user/ibus-env.service
[Unit]
Description=ibus environment initialization
Before=xorg.target

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl --user set-environment XMODIFIERS=@im=ibus
ExecStart=/usr/bin/systemctl --user set-environment GTK_IM_MODULE=ibus
ExecStart=/usr/bin/systemctl --user set-environment QT_IM_MODULE=ibus
~/.config/systemd/user/ibus.service
[Unit]
Description=ibus daemon
Wants=ibus-env.service
After=xorg.target

[Service]
ExecStart=/usr/bin/ibus-daemon
Restart=on-abort

[Install]
WantedBy=xorg.target

Lastly, you will need to enable ibus.service

ibus preferences

Configure ibus preferences by running:

$ ibus-setup

which brings forth a GUI.

Navigate to the 'Input Method' tab, click on 'Add', click on 'Japanese' and select your input method.

Now click on the newly added list entry and click on 'Preferences' to configure your input method.

Anthy prefrerences

Change 'Input Mode:' from 'Latin' to 'Hiragana'

After cofiguration

You can run ibus-daemon -dr or restart X to test your settings.

By default Super+Space cycles between your input methods

Provided everything went well you should be able to input Japanese in X.

See also

ibus
GitHub repository
Fonts
Japanese fonts showcase
modified Japanese fonts