适用于:
Ubuntu 24.04
GNOME / KDE
Wayland / X11
中文开发环境
VSCode / Chrome / Terminal
目标:
Fcitx5 + Rime(中州韵)+ 雾凇拼音/搜狗词库获得接近 Windows 搜狗输入法的体验,同时避免:
IBus Shift 卡键
Wayland 输入异常
Linux 搜狗兼容性差
Electron 输入失效
候选框漂移
一、为什么不推荐 IBus 和 Linux 搜狗输入法
Ubuntu 24.04 默认使用:
IBus + ibus-pinyin
但实际使用中经常出现:
-
Shift 卡住
-
中英文切换异常
-
Wayland 兼容问题
-
Electron 程序无法输入中文
-
候选框漂移
-
VSCode 输入异常
而 Linux 版搜狗输入法已经多年维护较少:
-
对 Wayland 支持一般
-
GNOME 兼容问题较多
-
Ubuntu 新版本容易出问题
目前 Linux 中文社区主流方案已经逐渐变成:
Fcitx5 + Rime
二、最终推荐架构
推荐组合:
Ubuntu 24.04
↓
Fcitx5
↓
Rime(中州韵)
↓
雾凇拼音 / 搜狗词库
优点:
-
稳定
-
Wayland 支持更好
-
高度可定制
-
无后台上传
-
词库现代
-
开发体验优秀
三、卸载 IBus
先删除 Ubuntu 默认输入法。
1. 卸载 ibus
sudo apt remove --purge ibus*
2. 清理残留
sudo apt autoremove
四、安装 Fcitx5
1. 安装核心组件
sudo apt update
sudo apt install \
fcitx5 \
fcitx5-rime \
fcitx5-configtool \
fcitx5-chinese-addons \
fcitx5-module-wayland \
fcitx5-frontend-gtk2 \
fcitx5-frontend-gtk3 \
fcitx5-frontend-gtk4 \
fcitx5-frontend-qt5
五、切换系统输入法框架
Ubuntu 需要指定输入法框架。
执行:
im-config
选择:
fcitx5
完成后重启系统:
reboot
六、配置 Fcitx5
启动配置工具:
fcitx5-configtool
添加输入法
添加:
Rime
删除多余键盘(可选)
可以删除:
Keyboard - English
避免输入法列表过长。
七、安装雾凇拼音(强烈推荐)
什么是雾凇拼音
"雾凇拼音" 是目前 Linux 中文社区非常流行的一套 Rime 配置。
特点:
-
现代中文词库
-
网络热词
-
AI 相关词汇
-
GitHub 项目词汇
-
Emoji
-
程序员友好
体验已经非常接近 Windows 搜狗输入法。
安装步骤
创建 Rime 配置目录:
mkdir -p ~/.local/share/fcitx5/rime
进入目录:
cd ~/.local/share/fcitx5/rime
克隆项目:
git clone https://github.com/iDvel/rime-ice.git temp
复制配置:
cp -r temp/* .
删除临时目录:
rm -rf temp
八、重新加载输入法
方法 1(推荐)
fcitx5-remote -r
方法 2
pkill fcitx5
fcitx5 -d
九、配置快捷键(推荐)
打开:
fcitx5-configtool
推荐快捷键:
| 功能 | 推荐 |
|---|---|
| 中英文切换 | Shift |
| 输入法切换 | Ctrl + Space |
| 候选翻页 | , 和 . |
这样最接近 Windows 搜狗。
十、Wayland 支持
Ubuntu 24.04 默认是:
Wayland
相比 IBus:
Fcitx5 对 Wayland 的支持明显更好
检查当前会话:
echo $XDG_SESSION_TYPE
如果输出:
wayland
说明当前正在使用 Wayland。
十一、修复 VSCode / Chrome 无法输入中文
部分 Electron 应用需要手动配置环境变量。
编辑:
nano ~/.profile
加入:
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx
export XMODIFIERS=@im=fcitx
保存后执行:
source ~/.profile
然后重启系统。
十二、导入搜狗词库(可选)
实际上:
雾凇拼音已经足够强
很多用户已经不再导入搜狗词库。
但如果需要,也可以导入 .scel 搜狗词库。
安装转换工具
sudo apt install python3-pip
pip install imewlconverter
转换词库
imewlconverter -i sogou.scel -o mydict.txt
放入 Rime 目录
复制到:
~/.local/share/fcitx5/rime/
然后重新部署输入法。
十三、常见问题
1. Shift 卡住
原因通常是:
-
IBus bug
-
Wayland 键盘状态异常
-
GNOME 快捷键冲突
切换到:
Fcitx5 + Rime
后通常会解决。
2. VSCode 无法输入中文
通常是 Electron 环境变量问题。
确认:
echo $GTK_IM_MODULE
输出应为:
fcitx
3. Chrome 候选框漂移
优先使用:
Fcitx5 + Wayland
不要使用旧版 Linux 搜狗。
4. 输入法不自动启动
加入自启动:
fcitx5 -d
十四、最终效果
最终你会得到:
-
接近 Windows 搜狗输入法体验
-
稳定中文输入
-
Wayland 支持
-
VSCode / Chrome 正常输入
-
更现代词库
-
无后台上传
-
更适合开发环境
十五、推荐扩展
推荐进一步配置:
-
Rime 模糊音
-
双拼
-
AI 联想词
-
中英混输
-
Vim 中文输入优化
-
Terminal 中文优化