索引
安装 Fcitx5
非必要不安装,极简教程
1. 卸载 ibus 框架
由于 ibus 和 fcitx 可能会冲突,先卸载 ibus(XIM 仅允许一个输入法框架运行)
sudo apt remove --purge ibus
2. 安装 fcitx5 输入法框架
sudo apt install fcitx5
会自动安装需要的依赖如fcitx5-frontend-gtk4
fcitx5-frontend-gtk3
fcitx5-frontend-qt5
等,这些并不需要显式指定
需要额外安装的:
fcitx5-frontend-gtk2
:支持一些旧的应用程序
qtwayland5
:为 Qt5 应用程序提供 Wayland 显示协议的支持(与 Fcitx5 更好地集成)
fcitx5-chinese-addons
:中文输入法支持
sudo apt update
sudo apt install fcitx5 fcitx5-chinese-addons qtwayland5 fcitx5-frontend-gtk2
3. 配置输入法环境变量
应用请求输入时候应该启用哪个输入法框架
新建文件配置文件 ~/.pam_environment
内容如下:
GTK_IM_MODULE=fcitx5
QT_IM_MODULE=fcitx5
XMODIFIERS=@im=fcitx5
INPUT_METHOD=fcitx5
SDL_IM_MODULE=fcitx5
GLFW_IM_MODULE=fcitx5
4. 配置系统输入法框架为 fcitx5
im-config -n fcitx5
5. 配置输入法开机自启动
这里使用 Gnome 的启动应用程序设置
- 按
Alt + F2
,输入gnome-session-properties
,回车。 - 在启动程序列表中,点击 添加。
- 在 名称 中输入 Fcitx5,在 命令 中输入
fcitx5
。 - 点击 添加,然后关闭对话框。
6. 注销重新登陆
正常的话右上角应该出现了输入法图标,如果有问题可以 fcitx5-diagnose 查看诊断信息进行修复
如果没出现(你的系统语言应该是 English),点输入法进行 configure, 取消勾选该项即可显示中文输入法选项
(可选)输入法使用优化
- 安装中文词库
词库位置:~/.local/share/fcitx5/pinyin/dictionaries/
wget https://github.com/felixonmars/fcitx5-pinyin-zhwiki/releases/download/0.2.4/zhwiki-20220416.dict
# 创建存储目录
mkdir -p ~/.local/share/fcitx5/pinyin/dictionaries/
# 移动词库文件至该目录
mv zhwiki-20220416.dict ~/.local/share/fcitx5/pinyin/dictionaries/
- 安装主题
主题位置:~/.local/share/fcitx5/themes
官方的皮肤:
sudo apt-get install fcitx5-material-color
github 上做的不错的皮肤:
https://github.com/sxqsfun/fcitx5-sogou-themes
git clone https://github.com/sxqsfun/fcitx5-sogou-themes.git
# fcitx5-sogou-themes 文件夹下的所有子文件夹(不包含 .git 和 readme.md)复制到 /home/huan/.local/share/fcitx5/themes 目录中
rsync -av --exclude='.git' --exclude='readme.md' fcitx5-sogou-themes/ /home/huan/.local/share/fcitx5/themes/
常用的配置
- 输入框单行/双行
打开该项即可
FAQ
- linux 上的微信无法切换输入法?
GTK_IM_MODULE=fcitx5
QT_IM_MODULE=fcitx #使用 fcitx
XMODIFIERS=@im=fcitx5
INPUT_METHOD=fcitx5
SDL_IM_MODULE=fcitx5
GLFW_IM_MODULE=fcitx5