Jesse Laprade


Setting up a Chinese input method on GNU/Linux

2019-11-05

This guide will teach you how to get a working Chinese input method on your GNU/Linux machine. It is intended for users who have basic graphical navigation and command line skills in Debian or a Debian-based Linux distribution.

This document consists of the following sections:

Conventions used in this guide

Requirements

Downloading the fcitx input method using apt

This section will guide you through downloading the fcitx package using the apt package manager. The fcitx package will allow you to type in Pinyin to produce Chinese characters.

To download the fcitx package using apt

  1. Run the following command:

    sudo apt install fcitx fcitx-sunpinyin
  2. Confirm the installation by typing y when prompted

Accessing fcitx’s configuration settings

This section will help you access fcitx’s configuration settings, so you can then make using fcitx more convenient.

To access fcitx’s configuration settings

  1. Run fcitx on the command line to access fcitx’s configuration settings

  2. Right-click the icon in your system tray (see Figure 1 below)

    Figure 1: A screenshot of the fcitx icon in the system tray
    Figure 1: A screenshot of the fcitx icon in the system tray
  3. Click Configure (see Figure 2 below)

    Figure 2: A screenshot of the fcitx menu popping up after right-clicking the icon in the system tray
    Figure 2: A screenshot of the fcitx menu popping up after right-clicking the icon in the system tray

    Tip: If your current input method does not show up in the fcitx configuration window, try to run pkill fcitx on the command line to kill the fcitx process, and then run fcitx to start the fcitx process again. If this still doesn’t work, try restarting your computer to ensure the fcitx and fcitx-sunpinyin packages have installed correctly

Finding the fcitx Sunpinyin input method

This section will help you find the Sunpinyin input method, so you can then add it to your list of active input methods.

To find the fcitx Sunpinyin input method

  1. Click the + symbol on the bottom-left of fcitx window (see Figure 3 below)

    Figure 3: A screenshot of the “+” symbol highlighted inside of the fcitx configuration window
    Figure 3: A screenshot of the “+” symbol highlighted inside of the fcitx configuration window
  2. Click Only Show Current Language to uncheck the Only Show Current Language box (see Figure 4 below)

    Figure 4: A screenshot of a list of language input methods, and the option “Only Show Current Language” is unchecked inside of the fcitx configuration window
    Figure 4: A screenshot of a list of language input methods, and the option “Only Show Current Language” is unchecked inside of the fcitx configuration window
  3. Click the search bar (see Figure 5 in the next step below)
  4. Search for sunpinyin (see Figure 5 below)

    Figure 5: A screenshot of a user searching for sunpinyin inside of the fcitx configuration window
    Figure 5: A screenshot of a user searching for sunpinyin inside of the fcitx configuration window
  5. Click Sunpinyin to select it (see Figure 6 in the next step below)
  6. Click the OK button in the bottom-right of the window (see Figure 6 below)

    Figure 6: A screenshot of sunpinyin selected and the “OK” button held down inside of the fcitx configuration window
    Figure 6: A screenshot of sunpinyin selected and the “OK” button held down inside of the fcitx configuration window
  7. Ensure that Sunpinyin has been added to your list of input methods (see Figure 7 below)

    Figure 7: A screenshot of the English US and Sunpinyin input methods listed in the fcitx configuration window
    Figure 7: A screenshot of the English US and Sunpinyin input methods listed in the fcitx configuration window
  8. Click Global Config at the top of the window (see Figure 8 below)

    Figure 8: A screenshot of the “Global Config” tab highlighted in the fcitx configuration window
    Figure 8: A screenshot of the “Global Config” tab highlighted in the fcitx configuration window

Configuring fcitx

This section will help you configure fcitx, so fcitx will be easier to access and use.

To configure fcitx

  1. Click the Show Advanced Options tab in the bottom-left corner of the fcitx configuration window
  2. Uncheck Use extra trigger key only after using it to inactivate
  3. Click the drop-down menu to the right of Extra key for trigger input method
  4. Choose Disabled
  5. Check Enable Hotkey to scroll Between Input Method
  6. Check Include Inactive when scrolling between Input Method
  7. Close the fcitx windows
  8. Ensure your settings match the settings shown in Figure 9 below

    Figure 9: A screenshot of the “Global Config” settings in the fcitx configuration window
    Figure 9: A screenshot of the “Global Config” settings in the fcitx configuration window

Enabling fcitx at startup

Gnome and Xfce desktop environments will automatically add fcitx to their startup applications.

Openbox requires you to put fcitx & in your ~/.config/openbox/autostart file. The fcitx part tells Openbox to start fcitx on startup, and the & part tells your computer to run fcitx as a background process.

If you are not using Gnome, Xfce, or Openbox, continue to the section below.

To enable fcitx at startup

  1. Add the following contents to your ~/.xinitrc file:

    fcitx
  2. Logout then log back in

Tip: If you don’t have an ~/.xinitrc file, then you can create one by running touch ~/.xinitrc

Making sure fcitx is working correctly

This section will guide you through a series of tests to ensure fcitx is workign correctly.

To make sure fcitx is working correctly

  1. Open up something you can type text into
  2. Hold down Ctrl
  3. While continuing to hold down ctrl, press spacebar
  4. Release spacebar
  5. Release Ctrl

You should now see the keyboard icon you saw earlier, if you have a taskbar, panel, or system tray (see Figure 10 below).

Figure 10: A screenshot of the Sunpinyin icon in a user’s system tray
Figure 10: A screenshot of the Sunpinyin icon in a user’s system tray

Tip: If you do not see the keyboard icon mentioned above, check out the fcitx documentation