在 Linux 上安装 Rime 输入法:完整指南

发布于:2025-03-09 ⋅ 阅读:(25) ⋅ 点赞:(0)

Rime(中州韻)是一款强大的输入法框架,支持多种输入方案,如小鹤双拼、朙月拼音、仓颉等。它跨平台支持 Windows、macOS 和 Linux,并且可以深度定制词库和输入方案。本文将详细介绍如何在 Linux 上安装和配置 Rime 输入法。


1. 选择合适的 Rime 输入法前端

在 Linux 上,Rime 仅提供输入法引擎,用户需要搭配合适的前端来使用。主流的输入法框架包括:

  • Fcitx5(推荐)—— 现代化的 Fcitx 版本,兼容性更好,推荐使用
  • Fcitx4(旧版)—— 适用于较老的 Linux 发行版
  • IBus—— 适用于 GNOME 桌面环境
  • Wayland 用户可以考虑 fcitx5

2. 安装 Fcitx5 及 Rime

2.1 Arch Linux / Manjaro

sudo pacman -S fcitx5 fcitx5-rime fcitx5-configtool

2.2 Ubuntu / Debian

sudo apt update
sudo apt install fcitx5 fcitx5-rime fcitx5-config-qt

Ubuntu 22.04 及以上默认使用 ibus,安装 Fcitx5 后请手动切换输入法框架。

2.3 Fedora

sudo dnf install fcitx5 fcitx5-rime fcitx5-configtool

3. 配置 Fcitx5

安装完成后,需要确保 Fcitx5 作为默认输入法框架,并启用 Rime。

3.1 设置环境变量

~/.profile~/.bashrc(或 ~/.zshrc)中加入:

export XMODIFIERS=@im=fcitx
export GTK_IM_MODULE=fcitx
export QT_IM_MODULE=fcitx

然后重新加载配置:

source ~/.profile

3.2 配置 Rime

启动 fcitx5 后,进入 fcitx5-configtool 进行配置:

fcitx5-configtool
  • "输入法" 选项卡中,添加 "Rime"
  • 重新启动 fcitx5
    pkill fcitx5 && fcitx5 &
    

4. 初始化 Rime 并修改输入方案

4.1 生成默认配置

首次使用 Rime 时,需要触发它生成默认配置:

rime_deployer

或使用 Fcitx5 方式:

fcitx5-remote -r

这将在 ~/.local/share/fcitx5/rime/ 目录下生成配置文件。

4.2 自定义输入方案

进入 ~/.local/share/fcitx5/rime/,可以修改 default.custom.yaml 以更改默认输入方案,例如启用小鹤双拼:

patch:
  schema_list:
    - schema: luna_pinyin  # 朙月拼音(默认)
    - schema: double_pinyin_flypy  # 小鹤双拼

保存后重新部署:

rime_deployer

或重启输入法:

fcitx5-remote -r

5. 测试输入法

在任意文本输入框中(如终端、浏览器、文本编辑器)按 Ctrl+Space 切换输入法,尝试输入中文。

如发现 Rime 没有生效,可以使用以下命令调试:

fcitx5-diagnose

6. 其他优化与进阶配置

  • 安装皮肤:Rime 支持自定义皮肤,可修改 default.custom.yaml 添加 UI 样式:
    patch:
      style:
        color_scheme: solarized_dark
    
  • 导入词库:可以在 ~/.local/share/fcitx5/rime/ 目录下添加 .dict.yaml 词库文件。
  • 自动同步配置:使用 Git 备份 Rime 配置,方便多设备同步。

7. 总结

本文介绍了如何在 Linux 上安装并配置 Rime 输入法,步骤包括:

  1. 安装 fcitx5fcitx5-rime
  2. 配置环境变量
  3. 启用 Rime 并初始化配置
  4. 修改 default.custom.yaml 进行个性化设置
  5. 重新部署并测试输入法