# From Fcitx4 to Fcitx5

The user experience of Fcitx4, some say it’s good, some say it’s bad. After switching through three different configurations, I still ended up with various issues that gave me a headache. Initially, I used fcitx-rime, but it becomes really annoying when it would always fail to switch between Chinese and English after using it for some time. So later, I switched to google-pinyin, which couldn’t add fuzzy pronunciation, and sunpinyin’s thesaurus was slightly difficult to use.

After searching online, I found that Fcitx5 has been under development for the past three years and has received positive reviews from many Arch users. So, I finally decided to migrate from Fcitx4 to Fcitx5.

# Installation

Since we’re on Manjaro, installing Fcitx5 is naturally very convenient. Additionally, Fcitx’s official Repo is on GitHub.

pacman -Rs $(pacman -Qsq fcitx) # Uninstall fcitx4
pacman -S fcitx5-chinese-addons fcitx5 fcitx5-gtk fcitx5-qt # Install fcitx5 from the community source
# Alternatively, you can choose to install fcitx5 from the archlinuxcn source using the command below
pacman -S fcitx5-chinese-addons-git fcitx5-git fcitx5-gtk-git fcitx5-qt5-git

For Debian users, refer to iovxw’s guide on installing fcitx5.

# Group Configuration

By default, Fcitx5 only supports Western keyboards. If you are using KDE, you can enable Pinyin in the system’s input method configuration. For other distributions like mine, configuration via files is necessary.

First, completely exit Fcitx5 by finding it in your Dash or Monitor. If Fcitx5 is running, the software will automatically overwrite the profile configuration after modification.

nano ~/.config/fcitx5/profile # Open profile with nano
vim ~/.config/fcitx5/profile # Open profile with vim
gedit ~/.config/fcitx5/profile # Open profile with gedit

According to old K’s guide, replace all contents of the profile configuration file with the following:

[Groups/0]
# Group Name
Name=Default
# Layout
Default Layout=us
# Default Input Method
DefaultIM=pinyin

[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=

[Groups/0/Items/1]
# Name
Name=pinyin
# Layout
Layout=

[GroupOrder]
0=Default

Fcitx5’s configuration file is easy to understand. The configuration will take effect after logging out and back in. After that, start Fcitx5 to experience the changes.

# Environment Variable Configuration

Modify ~/.pam_environment and add the following:

GTK_IM_MODULE=fcitx5
QT_IM_MODULE=fcitx5
XMODIFIERS="@im=fcitx5"

Use the command echo ${XDG_SESSION_TYPE} to check. If you are an X11 user, you should also add the following to ~/.xprofile:

fcitx5 &

# Fcitx5-Rime

Fcitx5 also supports Rime installation. Use pacman -S fcitx5-rime or pacman -S fcitx5-rime-git to install.

Edit the profile file:

nano ~/.config/fcitx5/profile # Open profile with nano

Edit the content to the following:

[Groups/0]
# Group Name
Name=Default
# Layout
Default Layout=us
# Default Input Method
DefaultIM=rime

[Groups/0/Items/0]
# Name
Name=keyboard-us
# Layout
Layout=

[Groups/0/Items/1]
# Name
Name=rime
# Layout
Layout=

[GroupOrder]
0=Default

The new version is compatible with the old version’s configuration, allowing you to directly copy the configuration and thesaurus using the command:

cp -r ~/.config/fcitx/rime ~/.local/share/fcitx5/rime

Alternatively, you can manually select the configurations you wish to keep.

# Personalization

# Turn Off Cloud Pinyin

Thanks to Qianxuan Zi, I turned off Cloud Pinyin to prevent live typing.

Modify ~/.config/fcitx5/conf/pinyin.conf:

# Enable Cloud Pinyin
CloudPinyinEnabled=False

# Disable Auto DPI

Fcitx5 automatically adjusts interface size based on different DPIs of multiple monitors. However, on a 27-inch monitor, the interface is smaller than on a 13-inch laptop screen, causing me trouble. I had to turn off this feature and adjust the font size to 14.

Modify ~/.config/fcitx5/conf/classicui.conf:

# Use Per-Screen DPI
PerScreenDPI=False

# Font (Set your preferred font)
Font="Noto Sans Regular 14"

# Customize Quick Input

sudo touch /usr/share/fcitx5/data/quickphrase.d/quick.mb # Create a mb file in the Fcitx5 data folder
sudo nano /usr/share/fcitx5/data/quickphrase.d/quick.mb # Edit with nano

Add code in the format input output to the file, one per line, to add quick input dictionaries.

For example, to input eg quickly and have e.g. appear in the candidate, simply add eg e.g. to the mb file.

Friendly tip: Quick input can be enabled with a semicolon, Rime does not support quick input.

# Use Skins

I use hosxy’s Material-color skin for Fcitx5, which is very easy to install. Just follow the Readme instructions.

The effect is stunning, comparable to the default Windows input method:

fcitx5 Material Color

There are multiple color options available, it’s incredibly beautiful, everyone go give it a star!

# Use Single-line Mode (inline_preedit)

The image above shows the single-line mode, which looks great, and I recommend enabling it.

For Fcitx5’s built-in Pinyin, modify ~/.config/fcitx5/conf/pinyin.conf.

For Fcitx5-rime, create or modify ~/.config/fcitx5/conf/rime.conf.

Add or modify the following:

# Display pre-edit text in applications when available
PreeditInApplication=True

On 2020/04/26, a spelling error in PreeditInApplicaation was fixed. The correct spelling should be used in the configuration file. If the incorrect spelling is still used, single-line mode cannot be enabled.

# Experience

Overall, the input experience of Fcitx5 is indeed slightly better than the previous version. Input is relatively smooth, switching between Chinese and English doesn’t require spaces after semicolons, and there are thoughtful features like automatic switching to half-width punctuation while typing in English.

In terms of appearance, the Material Color skin definitely adds a lot of points.

The only issue seems to be with the automatic DPI feature, which might need further refinement. Keep it up, old K!