Skip to content

Fcitx 4 升级到 Fcitx 5 #42

@syaofox

Description

@syaofox

以下是针对基于 Debian/Ubuntu (包括 Linux Mint) 的系统升级 Fcitx 5 的通用流程。

步骤一:卸载 Fcitx 4 及相关组件

为了避免冲突和确保系统干净,建议先移除 Fcitx 4 及其大部分关联包。

打开终端,运行以下命令:

# 移除 fcitx 核心
sudo apt purge fcitx fcitx-module-kimpanel fcitx-pinyin fcitx-config-gtk fcitx-ui-classic

# 自动移除不再需要的依赖项
sudo apt autoremove

步骤二:安装 Fcitx 5 核心及中文输入法

Fcitx 5 在官方软件源中的名称是 fcitx5,以及其配套的拼音输入法 fcitx5-pinyin

在终端运行以下命令进行安装:

# 安装 Fcitx 5 核心包
sudo apt install fcitx5

# 安装 Fcitx 5 的配置工具、面板和中文拼音输入法
sudo apt install fcitx5-configtool  fcitx5-frontend-gtk2 fcitx5-frontend-gtk3 fcitx5-frontend-qt5 fcitx5-pinyin

# 安装 Fcitx 5 核心及配置工具 (已在上次安装)
sudo apt install fcitx5 fcitx5-configtool fcitx5-pinyin

⚠️ 特别提示: 在较老的 Linux Mint 版本中,Fcitx 5 可能不在默认的软件源中。如果上面的命令提示找不到软件包,您可能需要添加 Fcitx 5 的 PPA 来获取最新的稳定版本:

# 添加 Fcitx 5 的 PPA
sudo add-apt-repository ppa:fcitx-team/nightly

# 更新软件包列表
sudo apt update

# 重新运行安装命令
sudo apt install fcitx5 fcitx5-configtool fcitx5-frontend-gtk3 fcitx5-frontend-qt5 fcitx5-pinyin

步骤三:配置系统级环境变量

这是解决不同工具包(尤其是 Qt)输入问题的最重要步骤。我们需要在系统级别定义输入法模块。在 Linux Mint (基于 Debian/Ubuntu) 中,/etc/environment 是设置全局变量的最佳位置。

打开 /etc/environment 文件,请确保以下三行被添加到文件末尾,并且其值都是 fcitx (这是 Fcitx 5 兼容旧系统的约定,不要写成 fcitx5):

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

步骤四:配置系统输入法框架

安装完成后,您需要告诉系统使用 Fcitx 5 作为默认的输入法框架。

  1. 运行 im-config
    im-config
  2. 在弹出的对话框中,通常选择 "Yes" 进入配置。
  3. 在输入法列表中,选择 fcitx5
  4. 保存并退出。

步骤四:重启系统

为了确保所有的环境变量和服务都正确加载 Fcitx 5,注销并重新登录您的桌面环境(或直接重启系统)是最好的做法。

重启后,Fcitx 5 应该会自动运行。您可以:

  1. 检查 Fcitx 5 是否运行: 查找托盘区是否有新的 Fcitx 5 图标。
  2. 配置输入法: 运行 fcitx5-configtool,或通过菜单找到 "Fcitx 5 配置" (或 Fcitx Configuration) 来添加和管理您的输入法(如 Pinyin、五笔等)。

完成这些步骤后,您就可以享受 Fcitx 5 的新特性和更美观的主题了!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions