Installing Rime input method on Linux

29 Oct 2022 , 2719 words

The following method worked for me on my new Manjaro Linux. It should work for other Linux distros as well, just make sure we change the commands to the corresponding ones of our distro’s package manager. (For example, Manjaro/Arch Linux’s package manager pacman has command pacman -S to install package, whereas another popular package manager apt has the command apt install to do a similar job.)

There are two popular input method frameworks on Linux: IBus, and Fcitx. Rime has implementations for both, but AFAIK only the IBus one is actively maintained by the author now. So that’s the one I’m installing.

In case we have installed or attempted to install fcitx Rime on our machine, to make sure there are no conflicts between the two frameworks or even two Rime implementations, let’s first remove the fcitx-rime package and the fcitx packages it depends on:

sudo pacman -Rsnu fcitx-rime

Here the flag -s is important because it makes the uninstallation recursive, cleaning up the dependencies for us.

Next, install the package ibus-rime:

sudo pacman -S ibus-rime

You can see from the output that packages ibus-rime depends on, including the IBus framework will be installed.

Once that is done. Change the environment variables to make IBus work properly on our machine:

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

Either add the environment variables in /etc/environment or our shell profile (.zshrc in my case).

You also want to have the start the IBus daemon :

ibus-daemon -drxR

In fact, you should probably add this command to your system’s autostart.

It wouldn’t hurt to restart the IBus now:

ibus restart

At this point, the IBus panel should have shown up on the system tray. If you get a “Can’t connect to IBus” error instead, it’s because you don’t have your IBus daemon running.

Next, I need to install the schema used by Rime. I use double Pinyin, which seems to rely on the more essential Luna Pinyin. So I installed both. The schema can be installed either by copying the schema file manually to ~/.config/ibus/rime or using the Rime’s configuration manager Plum.

Now we have everything we need installed, the final step is to enable the schema. This can be done by modifying the .config/ibus/rime/default.custom.yaml:

patch: schema_list: schema: double_pinyin_flypy

Now if you restart the IBus, it’s possible to see a notification saying some error occurred when starting Rime and it’s logged to /tmp/rime.ibus.ERROR. That file is missing on my machine and others too though. The most likely cause of this notification is that something is wrong with your default.custom.yaml file. When I got it, for example, it was because I used tab instead of spaces for indentation…

OK, 大功告成!