fedora 安装Fcitx5中文输入法

Author Avatar
半局局局局局
发表:2024-02-29 18:21:00
修改:2024-02-29 18:22:01

最小安装

为使用 Fcitx 5,需要安装三部分基本内容:

  1. Fcitx 5 主程序

  2. 中文输入法引擎

  3. 图形界面相关

首先安装 fcitx5 相关包:

sudo dnf install fcitx5 fcitx5-configtool fcitx5-frontend-gtk4 fcitx5-frontend-gtk3 fcitx5-frontend-gtk2 fcitx5-frontend-qt5

再安装中文输入法套件:

sudo dnf install fcitx5-chinese-addons

安装中文词库

在 GitHub 打开维基百科中文拼音词库的 Releases 界面,下载最新版的 .dict 文件。按照 README 的指导,将其复制到 ~/.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/

配置

设置为默认输入法

sudo alternatives --config xinputrc

输入编号切换输入法

环境变量

需要为桌面会话设置环境变量,即将以下配置项写入某一配置文件中:

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

如果使用 Bash 作为 shell,则建议写入至 ~/.bash_profile ,这样只对当前用户生效,而不影响其他用户。

另一个可以写入此配置的文件为系统级的 /etc/profile

开机自启动

安装 Fcitx 5 后并没有自动添加到开机自启动中,每次开机后需要手动在应用程序中找到并启动,非常繁琐。

解决方案非常简单,在 Tweaks(sudo dnf install gnome-tweaks)中将 Fcitx 5 添加到「开机启动程序」列表中即可。

自定义主题

Fcitx 5 默认的外观比较朴素,用户可以根据喜好使用自定义主题。

第一种方式为使用经典用户界面,可以在 GitHub 搜索主题,然后在 Fcitx5 configtool —— 「附加组件」 —— 「经典用户界面」中设置即可。

第二种方式为使用 Kim面板,一种基于 DBus 接口的用户界面。此处安装了 Input Method Panel 这个 GNOME 扩展,黑色的风格与正在使用的 GNOME 主题 Orchis-dark 非常搭配。

评论