Fcitx
Fcitx (Flexible Input Method Framework) is a lightweight input method framework aimed at providing environment independent language support for Linux. It supports a lot of different languages and also provides many useful non-CJK features.
Installation
Input method engines
Fcitx provides built-in input methods for Chinese Pinyin and table-based input (for example Wubi).
Depending on the language you wish to type, other input method engines are available:
Chinese
- fcitx-sunpinyin, based on sunpinyin. It strikes a good balance between speed and accuracy.
- fcitx-libpinyin, based on libpinyin. It has a better algorithm than fcitx-sunpinyin.
- fcitx-rime, based on schemas from the Rime IME project.
- fcitx-googlepinyin, the Google pinyin IME for Android.
- fcitx-sogoupinyinAUR, Sogou input method for linux—Supports, Jianpin, fuzzy sound, cloud input, English input, mixed skin.Official website
- fcitx-cloudpinyin uses internet sources to provide input candidates. The selected cloud result will be added to local dictionary. It support all fcitx pinyin input method except fcitx-rime.
- fcitx-chewing is a popular Zhuyin input engine for Traditional Chinese based on libchewing.
- fcitx-table-extra adds Cangjie, Zhengma, Boshiamy support.
Japanese
- fcitx-anthy, a popular Japanese input engine. However, it is not actively developed anymore.
- fcitx-mozc, based on Mozc, the Open Source Edition of Google Japanese Input.
- fcitx-kkc, a new Japanese Kana Kanji input engine, based on libkkc.
Other languages
- fcitx-hangul, for typing Korean hangul, based on libhangul.
- fcitx-unikey, for typing Vietnamese characters.
- fcitx-sayura, for typing Sinhalese.
- fcitx-m17n, for other languages provided by M17n.
Input method module
To obtain a better experience in Gtk+ and Qt programs, install the fcitx-gtk2, fcitx-gtk3, fcitx-qt4 and fcitx-qt5 input method modules as your need, or the fcitx-im group to install all of them. Without those modules, the input method may work on most applications but you may experience input method hang up, preview window screen location error or no preview error.
Applications below do not use Gtk+/Qt input module:
- Applications use Tk, motif or xlib
- Emacs, Opera, OpenOffice, LibreOffice, Skype, Wine, Java, Xterm, urxvt, WPS
Others
- fcitx-ui-light, light UI for fcitx.
- fcitx-fbterm[broken link: archived in aur-mirror], for Fbterm support.
- fcitx-table-extra, extra table.
- fcitx-table-other, tables for Latex, Emoji and others.
- kcm-fcitx, KDE configuration module for fcitx.
Others packages (including git version) are also available in the AUR. All components of fcitx will requires fcitx to restart after install.
Usage
Desktop Environment
If you are using any XDG compatible desktop environment such as KDE, GNOME, Xfce, LXDE, after you relogin, the autostart should work out of box. If not, open your favorite terminal, type fcitx
. To see if fcitx is working correctly, open an application such as leafpad and press CTRL+Space (the default shortcut for switching input method) to invoke FCITX and input some words.
If Fcitx failed to start with your desktop automatically or if you want to change the parameters to start fcitx, please use tools provided by your desktop environment to configure xdg auto start or edit the fcitx-autostart.desktop
file in your ~/.config/autostart/
directory (copy it from /etc/xdg/autostart/
if it doesn't exist yet).
If your desktop environment does not support xdg auto start, please add fcitx
to your startup script (after the environment variables are set up properly).
When other input methods with xim support is also running, Fcitx may fail to start due to xim error. Please make sure no other input method is running before you start Fcitx.
Non desktop environment
Define the environment variables to register the input method modules and support xim programs.
GTK_IM_MODULE=fcitx QT_IM_MODULE=fcitx XMODIFIERS=@im=fcitx
Re-login or reboot to make these environment changes effective.
.bashrc
for this, see DotFiles
Xim
Optionally, you can use xim in your GTK+ and/or Qt programs without installing the above modules in which case you need to change the corresponding lines above as following:
GTK_IM_MODULE=xim QT_IM_MODULE=xim
/usr/lib/gtk-2.0/2.10.0/immodules.cache
as immodule cache file since 2.24.20. If you have set GTM_IM_MODULE_FILE
environment variable or do not use install script of official packages to update the cache, please change/clear the environment variable and use /usr/bin/gtk-query-immodules-2.0 --update-cache
to update immodule cache.Configuration
Configuration tools
Fcitx provides GUI configure tools. You can install either kcm-fcitx(KDE), fcitx-configtool (based on gtk3). Run fcitx-config-gtk3 after fcitx-configtool is installed. Unset Only Show Current Language if you want to enable a input method of a different language.
Stop fcitx manually before changing configuration, or the change may be lost.
In order to enable spell checking, press ctrl + alt + h when fcitx is on a input method provides by fcitx-keyboard. Then that's it, you can type long word, to see whether it works.
Input methods configuration
You can add/remove input methods in GUI tools. Set first item to Keyborad layout (e.g. Keyboard - English) if you want to enable/disable other input methods quickly.
Change default UI
Fcitx support kimpanel protocol to provide bettter desktop intergation.
- Gnome-Shell: You can install kimpanel from extensions.gnome.org or gnome-shell-extension-kimpanel-gitAUR, which provides a similar user experience as ibus-gjs.
- KDE: kimtoy could use skin from Sogou and fcitx.
Extend pinyin dictionary
Pinyin dictionary is located at ~/.config/fcitx/pinyin
. File pybase.mb
is for single characters and file pyphrase.mb
defines pinyin phrases. To extend them, put your file into /usr/share/fcitx/pinyin
and restart fcitx.
Skins
You can download skins and extract them to one of the following directories, you can create the directory if it doesn't exist:
/usr/share/fcitx/skin #Global settings ~/.config/fcitx/skin #User settings
Cloud Pinyin configuration
After install fcitx-cloudpinyin input method, restart fcitx. If you could not find it in configuration GUI, enable advanced setting. The cloud query result will be added to current input method dictionary automatically.
If your network could not access Google, change Cloud Pinyin source to Baidu.
The query result from cloud will list as secondary candicate by default and it is configuable. If the result already exit, only one item is shown.
Tips and tricks
Clipboard Access
You can use fcitx to input text in you clipboard (as well as a short clipboard history and primary selection). The default trigger key is Control-;. You can change the trigger key as well as other options in the Clipboard addon configure page.
NOTE: This is NOT a clipboard manager, it doesn't hold the selection or change its content as what a clipboard manager is supposed to do. It can only be used to input from the clipboard.
Troubleshooting
Diagnose the problem
If you have problems using fcitx, eg. Ctrl+Space fail to work in all applications, then the first thing you should try is to diagnose using fcitx-diagnose
.
The output of fcitx-diagnose
should contain the clue to most common problems.
Providing the output of it will also help when you consult other people(eg. in IRC or forums).
Emacs
If your LC_CTYPE
is English, you may not be able to use input method in emacs due to an old emacs' bug. You can set your LC_CTYPE
to something else such as zh_CN.UTF-8
before emacs starts to get rid of this problem.
Note that the corresponding locale should be enabled on your your system. Uncomment the corresponding line, for example, zh_CN.UTF-8
, in /etc/locale.gen
and run locale-gen
.
The default fontset will use `-*-*-*-r-normal--14-*-*-*-*-*-*-*' as basefont(in src/xfns.c), if you do not have one matched(like terminus、or 75dpi things, you can look the output of `xlsfonts'), XIM can not be activated.
Emacs Daemon
If you are using emacs daemon/client mode, LC_CTYPE
should be set when starting the daemon. For example, by running emacs daemon with LC_CTYPE=zh_CN.UTF-8 emacs --daemon
.
If starting emacs daemon from systemd, set Environment in the unit file like this:
Environment="LC_CTYPE=zh_CN.UTF-8" "XMODIFIERS=@im=fcitx"
(XMODIFIERS may need to be set explicitly here as systemd doesn't load .xprofile. Check the initial-environment
variable in emacs to verify both variables are set correctly.)
For firefox above version 13, the popup menu may fail to work due to xim, please make sure that fcitx-gtk2 along with a latest version fcitx are installed.
Ctrl+Space fail to work in GTK programs
This problem sometimes happens especially when locale is set as English. Please make sure your GTK_IM_MODULE is set correctly.
See also FAQ
If you have set the *_IM_MODULE environment variables to fcitx but cannot activate fcitx, please check if you have installed the corresponding input method modules.
Some programs can only use xim, if you are using these programs, please make sure your XMODIFIERS is set properly and be aware of the problems you may have. These programs includes: all programs that are not using gtk or qt (e.g. programs that use tk, motif, or xlib directly), emacs, opera, openoffice, libreoffice, skype
If you cannot enable fcitx in gnome-terminal under gnome and the above way doesn't work, try:
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/IMModule':<'fcitx'>}"
Buildin Chinese Pinyin Default NOT ACTIVE
If your locale is en_US.UTF-8
, fcitx did NOT enable the buildin Chinese Pinyin input method by default. There is only fcitx-keyboard-us
input method enabled. You can get a notice by fcitx-diagnose
command like this:
## Input Methods: 1. Found 1 enabled input methods: fcitx-keyboard-us 2. Default input methods: **You only have one input method enabled, please add a keyboard input method as the first one and your main input method as the second one.**
Then you should add Pinyin
or Shuangpin
input method to actived input methods by the GUI configure tool.
fcitx and KDE
For some reasons, KDE doesn't handle keyboard layouts properly. For example, if you switch from US (English) to LT (Lithuanian), all numbers on the keyboard should produce Lithuanian letters, but they still produce numbers as the output. This can be fixed by these steps:
- Turn off
fcitx
if it's running in the background. - Disable stuff related to KDE:
- At System settings --> Input devices --> Layouts (tab) make sure that "Configure layouts" is unchecked.
- At System settings --> Input devices --> Advanced (tab) make sure that "Configure keyboard options" is unchecked.
- Open terminal and type
fcitx
to start it. You can close terminal -fcitx
will still be running in the background. - Set up your needed layouts (Right click on the system tray icon, then "Configure").
- Right click on the system tray icon, then "Exit"
At this point you should have working layouts, native KDE layouts switch icon should appear and you can switch them by mouse scroll or click on it.
Input method switched to English unintentionally
For instance, in XMind, when the user presses Enter to create a node, input method is always switched to English, and have to be switched back to Chinese manually.
To fix this issue, open the fcitx GUI configuration tool (provided by fcitx-configtool), switch to tab "Global Config", in dropdown menu "Share State Among Window", select "PerProgram" or "All".
xmodmap settings being overwritten
Fcitx controls keyboard layout, so your xmodmap settings will be overwritten. Since 4.2.7, Fcitx will try to load ~/.Xmodmap if it exists.
For more details on how you can save your xmodmap changes see FAQ