menu Chancel's blog
rss_feed
Chancel's blog
有善始者实繁,能克终者盖寡。

Manjaro安装Fcitx5Rime并引入自定义词库

作者:Chancel Yang, 创建:2021-06-16, 字数:3753, 已阅:135, 最后更新:2024-03-10

系统环境信息

  • Manjaro KDE

首先卸载所有关于fcitx的包

Bash
sudo pacman -Rs $(pacman -Qsq fcitx)

安装fcitx5以及相关的安装包

Bash
sudo pacman -S fcitx5-im fcitx5-configtool fcitx5-rime fcitx5-chinese-addons

配置环境变量 vim ~/.xprofile

INI
GTK_IM_MODULE DEFAULT=fcitx
QT_IM_MODULE  DEFAULT=fcitx
XMODIFIERS    DEFAULT=\@im=fcitx
SDL_IM_MODULE DEFAULT=fcitx

根据需要配置输入模式,编辑 ~/.local/share/fcitx5/rime/default.custom.yaml(如不存在则创建文件)

Bash
cat ~/.local/share/fcitx5/rime/default.custom.yaml 

# 输入如下

# default.custom.yaml
# save it to: 
#   ~/.config/share/fcitx5/rime  (linux)
#   ~/Library/Rime       (macos)
#   %APPDATA%\Rime       (windows)

patch:
  schema_list:
    #    - schema: luna_pinyin          # 朙月拼音
        - schema: luna_pinyin_simp     # 朙月拼音 简化字模
    #    - schema: luna_pinyin_tw       # 朙月拼音 臺灣正體模式
    #    - schema: terra_pinyin         # 地球拼音 dì qiú pīn yīn
    #    - schema: bopomofo             # 注音
    #    - schema: bopomofo_tw          # 注音 臺灣正體模式
    #    - schema: jyutping             # 粵拼
    #    - schema: cangjie5             # 倉頡五代
    #    - schema: cangjie5_express     # 倉頡 快打模式
    #    - schema: quick5               # 速成
    #    - schema: wubi86               # 五笔86
    #    - schema: wubi_pinyin          # 五笔拼音混合輸入
    #    - schema: double_pinyin        # 自然碼雙拼
    #    - schema: double_pinyin_mspy   # 微軟雙拼
    #    - schema: double_pinyin_abc    # 智能ABC雙拼
    #    - schema: double_pinyin_flypy  # 小鶴雙拼
    #    - schema: wugniu        # 吳語上海話(新派)
    #    - schema: wugniu_lopha  # 吳語上海話(老派)
    #    - schema: sampheng      # 中古漢語三拼
    #    - schema: zyenpheng     # 中古漢語全拼
    #    - schema: ipa_xsampa    # X-SAMPA 國際音標
    #    - schema: emoji         # emoji表情
    # # # "translator/dictionary": luna_pinyin.extended

引入词库,选择需要的自定义词库,如

在Release中下载词典文件(YAML格式),并把下载的词典移动到~/.local/share/fcitx5/rime/中

Bash
cp moegirl.dict.yaml ~/.local/share/fcitx5/rime/
cp zhwiki-20220127.dict.yaml ~/.local/share/fcitx5/rime/

然后创建如下文件

  • ~/.local/share/fcitx5/rime/luna_pinyin.custom.yaml
  • ~/.local/share/fcitx5/rime/extended.dict.yaml

luna_pinyin.custom.yaml内容如下

Bash
cat ~/.local/share/fcitx5/rime/luna_pinyin.custom.yaml

# 输出如下
patch:
    "translator/dictionary": extended # 词典名字可自定义,与创建的第二个文件名(extended.dict.yaml)保持一致即可

extended.dict.yaml内容如下

Bash
cat ~/.local/share/fcitx5/rime/extended.dict.yaml

# 输出如下
name: extended
version: "2021.02.19"
sort: by_weight
use_preset_vocabulary: true
import_tables:
  - luna_pinyin
  - zhwiki-20220127
  - moegirl

注销用户(重启fcitx5)后,打开 fcitx Configuration,选择添加rime即可使用

PS:如何验证词库加载成功?打个“贾跃亭”试试看能不能匹配出来

(可选)更换输入法皮肤

可参考Github仓库:https://github.com/thep0y/fcitx5-themes.git

皮肤安装方法如下

Bash
git clone https://github.com/thep0y/fcitx5-themes.git
cp -r fcitx5-themes/spring ~/.local/share/fcitx5/themes
cp -r fcitx5-themes/summer ~/.local/share/fcitx5/themes
cp -r fcitx5-themes/autumn ~/.local/share/fcitx5/themes
cp -r fcitx5-themes/winter ~/.local/share/fcitx5/themes
cp -r fcitx5-themes/green ~/.local/share/fcitx5/themes
cp -r fcitx5-themes/transparent-green ~/.local/share/fcitx5/themes
rm -r fcitx5-themes

然后编辑~/.config/fcitx5/conf/classicui.conf,配置文件如下

Bash
cat ~/.config/fcitx5/conf/classicui.conf

# 输出如下
Vertical Candidate List=False # 关闭垂直候选列表
PerScreenDPI=True # 根据屏幕DPI调整后选词大小
Font="Smartisan Compact CNS 13"
Theme=spring

参考资料


[[replyMessage== null?"发表评论":"发表评论 @ " + replyMessage.m_author]]

account_circle
email
web_asset
textsms

评论列表([[messageResponse.total]])

还没有可以显示的留言...
[[messageItem.m_author]] [[messageItem.m_author]]
[[messageItem.create_time]]
[[getEnviron(messageItem.m_environ)]]
[[subMessage.m_author]] [[subMessage.m_author]] @ [[subMessage.parent_message.m_author]] [[subMessage.parent_message.m_author]]
[[subMessage.create_time]]
[[getEnviron(messageItem.m_environ)]]