Difference between revisions of "Fcitx"

From ArchWiki
Jump to: navigation, search
(Using FCITX to input Chinese)
(43 intermediate revisions by 11 users not shown)
Line 1: Line 1:
[[Category: Internationalization (English)]]
+
[[Category:Internationalization]]
{{i18n|Fcitx}}
+
[[zh-CN:Fcitx]]
 
+
[http://code.google.com/p/fcitx/ FCITX] (Flexible Input Method Framework) is a [http://en.wikipedia.org/wiki/Input_method input method framework] aiming at providing environment independent language support for Linux. It supports a lot of different languages and also provides many useful non-CJK features.
[http://code.google.com/p/fcitx/ FCITX] ('''F'''ree '''C'''hinese '''I'''nput '''T'''oy of '''X''') is a collection of Simplified Chinese input methods for Linux.
+
  
 
==Installation==
 
==Installation==
{{Package Official|fcitx}} can be installed with [[Pacman]] from the [extra] repository.
+
{{Pkg|fcitx}} can be installed with [[Pacman]] from the [community] repository.
 +
 
 +
In order to have a better experience in gtk and qt programs (especially gtk programs) (e.g. better cursor following) and get rid of many unsolvable problems/bugs caused by xim, please install the corresponding input method modules for gtk and qt: {{Pkg|fcitx-gtk2}} (for gtk2 programs), {{Pkg|fcitx-gtk3}} (for gtk3 programs) and {{Pkg|fcitx-qt}} (for qt programs).
  
==Using FCITX to input Chinese==
+
==Using FCITX to Input==
 
Before you can make use of FCITX for input, you have to setup some environment variables.  It is quite simple.
 
Before you can make use of FCITX for input, you have to setup some environment variables.  It is quite simple.
*Open the {{filename|.xprofile}} file in your home directory and add following lines:
+
*Adding the following lines to your desktop startup script files ({{ic|.xprofile}} or {{ic|.profile}} when you are using KDM, GDM or LightDM, and {{ic|.xinitrc}} when you are using startx or Slim). With these lines, fcitx will work along with gtk/qt input method modules and support xim programs (Please make sure the necessary input method modules are already installed):
   #setup XIM environment, need not if use SCIM as gtk-immodules
+
 
 +
   export GTK_IM_MODULE=fcitx
 +
  export QT_IM_MODULE=fcitx
 +
  export XMODIFIERS="@im=fcitx"
 +
 
 +
Optionally, you can also choose to use xim in your gtk and/or qt programs, in which case you need to change the corresponding lines above as following:
 +
 
 
   export GTK_IM_MODULE=xim
 
   export GTK_IM_MODULE=xim
 
   export QT_IM_MODULE=xim
 
   export QT_IM_MODULE=xim
  export XMODIFIERS="@im=fcitx"
 
  
*Re-login to make such environment effective.  
+
{{Warning| Using xim can sometimes cause problems that are not solvable by any input method including not being able to input, no cursor following, application freeze on input method restart. For these xim related problems, Fcitx cannot provide any fix or support. This is the same with any other input method framework, so please use toolkit (gtk/qt) input method modules instead of xim whenever possible}}
 
+
After you re-login, open your favorite terminal, type:
+
  
  fcitx &
+
*Re-login to make such environment effective.
  
To see if fcitx is working correctly, open an application such as leafpad and press CTRL+Space to invoke FCITX and input some words.
+
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:
  
If everything goes well, you may want to start FCITX automatically whenever you start X.
+
  $ fcitx
  
Open the {{filename|.xinitrc}} file (see [[xinitrc]]) in your home directory, add line before starting your WM:
+
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.
  
  killall fcitx
+
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 {{ic|fcitx-autostart.desktop}} file in your {{ic|~/.config/autostart/}} directory (copy it from {{ic|/etc/xdg/autostart/}} if it doesn't exist yet).
  fcitx &
+
  
That is it.
+
If your desktop environment does not support xdg auto start, please add the following command to your startup script (after the environment variables are set up properly).
  
If you use any type of XDM (gdm for example), you should set up such environment in {{filename|~/.profile}} instead of above two files.
+
$ fcitx
  
Enjoy!
+
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.
  
===Fcixt with KDM===
+
==Configuration==
To have FCITX start automatically with KDM, add the following lines to {{filename|/usr/share/config/kdm/Xstartup}}
+
  
  LANG=zh_CN.UTF-8
+
Fcitx provides GUI configure tool. You can install either {{Pkg|kcm-fcitx}}(based on kcm), {{Pkg|fcitx-configtool}}(based on gtk3), or {{AUR|fcitx-configtool-gtk2}}(based on gtk2, unsupported) from [[Arch User Repository|AUR]].
  export LANG
+
  LC_CTYPE=zh_CN.UTF-8
+
  export LC_CTYPE
+
  export XMODIFIERS="@im=fcitx"
+
  #pkill fcitx
+
  fcitx&
+
  
Add following lines to {{filename|/etc/profile}}
+
==Desktop Environment Integration==
+
 
  export XIM=fcitx
+
===Gnome-Shell===
  export XIM_PROGRAM=fcitx
+
 
  export GTK_IM_MODULE=xim
+
You can install {{AUR|gnome-shell-extension-kimpanel-git}} package in [[Arch User Repository|AUR]], which provides a similar user experience as ibus-gjs.
  export QT_IM_MODULE=xim
+
 
  export XMODIFIERS="@im=fcitx"
+
===KDE===
 +
 
 +
You can install {{Pkg|kcm-fcitx}} and {{Pkg|kdeplasma-addons-applets-kimpanel}}.
 +
 
 +
{{Pkg|kcm-fcitx}} is a kcontrol module for fcitx.
 +
 
 +
{{Pkg|kdeplasma-addons-applets-kimpanel}} is a plasmoids providing native feeling under kde. Simply add kimpanel to plasma and fcitx will automatically switch to it without extra configuration.
 +
 
 +
==Install other components of fcitx==
 +
All components of fcitx will requires fcitx to restart after install.
 +
 
 +
===Keyboard layout integration===
 +
fcitx-keyboard is now built-in supported. Open a configuration tool ({{Pkg|kcm-fcitx}} or {{Pkg|fcitx-configtool}} mentioned above), you might want to uncheck the "Show only current language" and find your keyboard layout.
 +
 
 +
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.
 +
 
 +
===Chinese Input===
 +
fcitx built-in provides fcitx-pinyin and fcitx-table inside {{Pkg|fcitx}} package, which supports [[wikipedia:Pinyin|Pinyin]] and table-based input method, for example, [[wikipedia:Wubi|Wubi]].
 +
 
 +
If you want better support for pinyin, you can install, {{Pkg|fcitx-cloudpinyin}}, {{Pkg|fcitx-sunpinyin}}, {{Pkg|fcitx-googlepinyin}} or {{Pkg|fcitx-libpinyin}}.
 +
 
 +
If you need [[wikipedia:Bopomofo|Bopomofo]] support, you can install {{Pkg|fcitx-chewing}} or {{Pkg|fcitx-libpinyin}}.
 +
 
 +
If you need [[wikipedia:Cangjie_input_method|Cangjie]], [[wikipedia:Zhengma|Zhengma]], [[wikipedia:Boshiamy|Boshiamy]] support, you can install {{AUR|fcitx-table-extra}} in [[Arch User Repository|AUR]].
 +
 
 +
===Japanese Input Method===
 +
Install {{Pkg|fcitx-anthy}} or {{Pkg|fcitx-mozc}}.
 +
 
 +
===Korean Input Method===
 +
Install {{AUR|fcitx-hangul}} in [[Arch User Repository|AUR]].
 +
 
 +
===Other language===
 +
[http://www.m17n.org/index.html m17n] provides quite a long other language support, you can install m17n support for fcitx with {{AUR|fcitx-m17n}} in [[Arch User Repository|AUR]].
  
 
==Troubleshooting==
 
==Troubleshooting==
===CTRL+Space does not work===
+
* Emacs
If you cannot invoke FCITX by pressing the CTRL+Space keyboard combination, but FCITX runs in background without problem, please check your [[locale]]:
+
If your LC_CTYPE is English, you may not be able to use input method in emacs due to a 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.
  
  [ganlu@A ~]$ locale
+
* Input method module
  LANG=en_US
+
{{Warning| You may still be able to use input method in most programs without the input method module, however, you may have unsolvable weird problems if you do so.}}
  LC_CTYPE=en_US.utf8
+
  LC_NUMERIC="en_US"
+
  LC_TIME="en_US"
+
  LC_COLLATE=C
+
  LC_MONETARY="en_US"
+
  LC_MESSAGES="en_US"
+
  LC_PAPER="en_US"
+
  LC_NAME="en_US"
+
  LC_ADDRESS="en_US"
+
  LC_TELEPHONE="en_US"
+
  LC_MEASUREMENT="en_US"
+
  LC_IDENTIFICATION="en_US"
+
  LC_ALL=
+
  
Above is what I get from command 'locale', so you can know for sure FCITX does support utf8 (en_US.utf8 at least) locale without problem. If your locale output shows you having set up a utf8 locale correctly, then I suggest you check if your bash does support utf8 locale:
+
{{Warning| 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.}}
$ locale -a
+
 
to see if your current locale in there, if not, do not worry, make it yourself:
+
* Ctrl+Space fail to work in GTK2 programs
  $ localedef -vci en_US -f utf8 en_US.utf8
+
 
then, relogin to see if that works.
+
This problem sometimes happens when locale is set as English. From the official [http://fcitx.github.com/handbook/faq.html#ctrl_space FAQ], simply use:
If terrible things continue, I have to suggest you try any locale with "zh_CN", for example:
+
 
  export LC_CTYPE=zh_CN.GBK
+
  # gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules
For more information about locale, please find it in Google.
+
 
 +
then edit gtk.immodules,and change the corresponding line as below:
  
{{Note|You do not need to change your locale (such as LC_CTYPE) to a Chinese locale, ie: zh_CN.GBK, if you edit {{filename|/etc/gtk-2.0/gtk.immodules}}, and change this line:
 
  "xim" "X Input Method" "gtk20" "/usr/share/locale" "ko:ja:th:zh"
 
to:
 
 
   "xim" "X Input Method" "gtk20" "/usr/share/locale" "en:ko:ja:th:zh"
 
   "xim" "X Input Method" "gtk20" "/usr/share/locale" "en:ko:ja:th:zh"
Very easy.
 
}}
 
  
===Characters are displayed as blank boxes===
+
{{Warning| This file might be regenerated when gtk2 modules are updated, please remember to edit it.}}
If you can trigger FCITX but the characters on it are displayed as blank boxes, open {{filename|~/.config/fctix/config}} and change the line:
+
 
显示字体(中)=*
+
 
to  
+
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.
显示字体(中)=AR PL ShanHeiSun Uni
+
 
I am using uming font here, so be sure you have installed {{Package Official|ttf-arphic-uming}}. Restart FCITX:
+
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
$ pkill fcitx
+
$ fcitx &
+
If you have no config file after setup 3.6.3, you could generate it by:
+
fcitx -c
+
  
All configuration of FCITX can be found in {{filename|~/.config/fctix/config}}, however you had better understand Chinese. :- )
+
==See also==
 +
*[https://github.com/fcitx/fcitx/ Fcitx GitHub]
 +
*[https://code.google.com/p/fcitx/ Fcitx Google Code]
 +
*[http://fcitx-im.org/ Fcitx Wiki]

Revision as of 09:42, 21 December 2012

FCITX (Flexible Input Method Framework) is a input method framework aiming at providing environment independent language support for Linux. It supports a lot of different languages and also provides many useful non-CJK features.

Installation

fcitx can be installed with Pacman from the [community] repository.

In order to have a better experience in gtk and qt programs (especially gtk programs) (e.g. better cursor following) and get rid of many unsolvable problems/bugs caused by xim, please install the corresponding input method modules for gtk and qt: fcitx-gtk2 (for gtk2 programs), fcitx-gtk3 (for gtk3 programs) and fcitx-qt (for qt programs).

Using FCITX to Input

Before you can make use of FCITX for input, you have to setup some environment variables. It is quite simple.

  • Adding the following lines to your desktop startup script files (.xprofile or .profile when you are using KDM, GDM or LightDM, and .xinitrc when you are using startx or Slim). With these lines, fcitx will work along with gtk/qt input method modules and support xim programs (Please make sure the necessary input method modules are already installed):
 export GTK_IM_MODULE=fcitx
 export QT_IM_MODULE=fcitx
 export XMODIFIERS="@im=fcitx"

Optionally, you can also choose to use xim in your gtk and/or qt programs, in which case you need to change the corresponding lines above as following:

 export GTK_IM_MODULE=xim
 export QT_IM_MODULE=xim
Warning: Using xim can sometimes cause problems that are not solvable by any input method including not being able to input, no cursor following, application freeze on input method restart. For these xim related problems, Fcitx cannot provide any fix or support. This is the same with any other input method framework, so please use toolkit (gtk/qt) input method modules instead of xim whenever possible
  • Re-login to make such environment effective.

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 the following command to your startup script (after the environment variables are set up properly).

$ fcitx

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.

Configuration

Fcitx provides GUI configure tool. You can install either kcm-fcitx(based on kcm), fcitx-configtool(based on gtk3), or fcitx-configtool-gtk2AUR(based on gtk2, unsupported) from AUR.

Desktop Environment Integration

Gnome-Shell

You can install gnome-shell-extension-kimpanel-gitAUR package in AUR, which provides a similar user experience as ibus-gjs.

KDE

You can install kcm-fcitx and kdeplasma-addons-applets-kimpanel.

kcm-fcitx is a kcontrol module for fcitx.

kdeplasma-addons-applets-kimpanel is a plasmoids providing native feeling under kde. Simply add kimpanel to plasma and fcitx will automatically switch to it without extra configuration.

Install other components of fcitx

All components of fcitx will requires fcitx to restart after install.

Keyboard layout integration

fcitx-keyboard is now built-in supported. Open a configuration tool (kcm-fcitx or fcitx-configtool mentioned above), you might want to uncheck the "Show only current language" and find your keyboard layout.

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.

Chinese Input

fcitx built-in provides fcitx-pinyin and fcitx-table inside fcitx package, which supports Pinyin and table-based input method, for example, Wubi.

If you want better support for pinyin, you can install, fcitx-cloudpinyin, fcitx-sunpinyin, fcitx-googlepinyin or fcitx-libpinyin.

If you need Bopomofo support, you can install fcitx-chewing or fcitx-libpinyin.

If you need Cangjie, Zhengma, Boshiamy support, you can install fcitx-table-extraAUR in AUR.

Japanese Input Method

Install fcitx-anthy or fcitx-mozc.

Korean Input Method

Install fcitx-hangulAUR in AUR.

Other language

m17n provides quite a long other language support, you can install m17n support for fcitx with fcitx-m17nAUR in AUR.

Troubleshooting

  • Emacs

If your LC_CTYPE is English, you may not be able to use input method in emacs due to a 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.

  • Input method module
Warning: You may still be able to use input method in most programs without the input method module, however, you may have unsolvable weird problems if you do so.
Warning: 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 GTK2 programs

This problem sometimes happens when locale is set as English. From the official FAQ, simply use:

# gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules

then edit gtk.immodules,and change the corresponding line as below:

 "xim" "X Input Method" "gtk20" "/usr/share/locale" "en:ko:ja:th:zh"
Warning: This file might be regenerated when gtk2 modules are updated, please remember to edit it.


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

See also