hello-world.png

TL;DR
  1. Install the packages
pacman -Syu fcitx5-im fcitx5-rime
  1. Copy cangjie-system/rime-cangjie-integrated to fcitx5’s location:
git clone https://github.com/cangjie-system/rime-cangjie-integrated ~/.local/share/fcitx5/rime/rime-cangjie-integrated
cp ~/.local/share/fcitx5/rime/rime-cangjie-integrated/*.yaml ~/.local/share/fcitx5/rime/
  1. Create the following file:
touch ~/.local/share/fcitx5/rime/default.custom.yaml
  1. Add the following to default.custom.yaml to tell fcitx5 to use cangjie:
patch:
  schema_list:
    - schema: cangjie
  1. Set the following environment variables via /etc/environment:
QT_IM_MODULE=fcitx
QT_IM_MODULES="wayland;fcitx"
XMODIFIERS="@im=fcitx"
  1. Log out and then log in

  2. Click Deploy in rime

  3. Press Ctrl+Space and you should be able to type Cangjie 3rd gen!

Introduction

Figuring out how to type languages other than English is notoriously difficult on Linux. On Windows or MacOS, it’s only a few clicks away from typing, say, Japanese or Korean. But since we’re using Linux, we have to spend days figuring this out.

fcitx5: Input Method Framework

fcitx5-rime: Input Method Engine (IME) for fcitx5

graph

Pre-requisites

Tested in the following environment:

  • OS: Arch Linux (x86_64)
  • Kernel: Linux 6.9.1-arch1-1
  • WM: Hyprland (Wayland)

You don’t have to be using ArchLinux and Hyprland, but the target audience of this guide is users running Wayland. We’ll NOT be using ibus or fcitx (which is fcitx5’s predecessor).

Before We Begin

Given existing config might cause unexpected problems, we’ll make a backup and then delete the existing config.

  1. Kill fcitx5:
pkill fcitx5
  1. Make a backup of existing config:
mkdir -p ~/Downloads/fcitx5/{config_fcitx5,local_share_fcitx5}
cp -r ~/.config/fcitx5 ~/Downloads/fcitx5/config_fcitx5/
cp -r ~/.local/share/fcitx5 ~/Downloads/fcitx5/local_share_fcitx5/
  1. Delete the previous fcitx5 config:
rm -rf ~/.config/fcitx5 ~/.local/share/fcitx5

Getting Started

  1. Install the packages
pacman -Syu fcitx5-im fcitx5-rime
  • fcitx5-im includes fcitx5, fcitx5-gtk, fcitx5-qt, and fcitx5-configtool
  • fcitx5-rime is rime for fcitx5
  1. Setting Environment Variables

I have the following in my Hyprland config:

env = QT_IM_MODULE, fcitx
env = QT_IM_MODULES, "wayland;fcitx"
env = XMODIFIERS, "@im=fcitx"

If you are not using Hyprland, you may set them via /etc/environment:

QT_IM_MODULE=fcitx
QT_IM_MODULES="wayland;fcitx"
XMODIFIERS="@im=fcitx"
Warning
Do NOT set GTK_IM_MODULE! Reference

Given there are various versions of both GTK and QT applications, you need to read Using Fcitx5 on Wayland to see what env variables you need to set. Regardless, the above 3 are a must.

  1. Log out and log back in, or simply restart your machine

  2. Add rime to fcitx5:

I. Right click fcitx5 (the keyboard icon on your system tray) and then left click Configure

tray.png

II. Add rime as shown below:

add-rime.png

  1. Left clicking on the keyboard icon and you should see the following rime notification:

notification

  1. Choose “倉頡五代” and you should be able to type Cangjie 5th gen already!

5th

Installing Cangjie 3rd gen

Quote
I thought we are installing Cangjie 3rd gen?

Yes we are!

Note
There are various Cangjie 3rd gen schemas. I’m using cangjie-system/rime-cangjie-integrated.
  1. git clone cangjie-system/rime-cangjie-integrated to fcitx5’s location:
git clone https://github.com/cangjie-system/rime-cangjie-integrated ~/.local/share/fcitx5/rime/rime-cangjie-integrated
  1. Copy various *.yaml files to ~/.local/share/fcitx5/rime/:
cp ~/.local/share/fcitx5/rime/rime-cangjie-integrated/*.yaml ~/.local/share/fcitx5/rime/
  1. Tell fcitx5 to use cangjie when we choose rime:

I. Create the file default.custom.yaml:

touch ~/.local/share/fcitx5/rime/default.custom.yaml

II. Add the following to default.custom.yaml:

patch:
  schema_list:
    - schema: cangjie
  1. Deploy the changes to rime:

I. Right click on fcitx5 (again, the keyboard icon on your system tray)

II. Left click on Rime

III. Right click again on fcitx5

IV. Hover on the item (with the world icon) below Rime

V. Select Deploy

deploy.png

  1. Press Ctrl+Space and you should be able to type Cangjie 3rd gen!

hello-world.png

Bonus: theming fcitx5

You may choose different themes. I’m using Fcitx5-Material-Color.

  1. Install the package:
pacman -Syu fcitx5-material-color
  1. Create the following file:
touch ~/.config/fcitx5/conf/classicui.conf
  1. Add the following to classicui.conf:
Vertical Candidate List=False
Theme="Material-Color-Black"
  1. Kill fcitx5
pkill fcitx5
  1. Reload fcitx5
fcitx5-remote -r

And you should see your theme applied!

Reference