Install fcitx5 using the commands below:
sudo pacman -S fcitx5-im
sudo pacman -S fcitx5-chinese-addons fcitx5-rime
Add the following lines to /etc/environment:
# /etc/environment
GTK_IM_MODULE=fcitx
QT_IM_MODULE=fcitx
XMODIFIERS=@im=fcitx
SDL_IM_MODULE=fcitx
Reboot the system.
