Fcitx5 rime / pinyin not working on Hyprland / Sway

I am trying to get a pinyin layout alongside English working with fcitx5. To do this I am setting the input method to fcitx5 and using rime.

I have searched dozens of open issues about this but nothing seems to help. So I am opening my own. Thank you to this community for having helped me in the past.

I cannot get rime support to work, which is required for rime’s pinyin keyboard.

If you have rime working on Nixos and Wayland (especially Hyprland) can you share your configs?

Current configuration:

Fcitx-configtool

Inside the fcitx-configtool I have selected:

Keyboard - English (US)
Rime
Pinyin

Unfortunately when I try to use either Rime or Pinyin I get “Rime (not available)” and similarly for pinyin.

Nixos configuration

i18n = {
  defaultLocale = "en_US.UTF-8";
  inputMethod = {
    enabled = "fcitx5";
    fcitx5.addons = with pkgs; [
        fcitx5-rime
        fcitx5-chinese-addons
        librime
    ];
  };
};

Main issue

For some reason, librime is not being picked up by fcitx. journalctl sheds some light. fcitx cannot find rime

[addonmanager.cpp:189] Could not load addon rime
[addonloader.cpp:32] Could not locate library librime.so for addon rime.

Other potentially relevant info

Window Manager: Hyprland v0.37.1Relevant environment variables:

GLFW_IM_MODULE = fcitx
GTK_IM_MODULE = fcitx
INPUT_METHOD = fcitx
XMODIFIERS = @im=fcitx
IMSETTINGS_MODULE = fcitx
QT_IM_MODULE = fcitx
SDL_IM_MODULE = fcitx

Did you ever get this working? I had it working in Sway like 2 years ago, but then it stopped working at some point and I haven’t had it working for maybe a year. Never saw it working in Hyprland either.

default.nix - Repos (azure.com)
你可以参考此配置,因为rime需要有数据包,但是在nixos下只能从配置文件中设定让脚本去执行,没有办法和其他操作系统一样手动放入文件。
You can refer to this configuration, because RIME needs to have a data package, but in NixOS, you can only set the script to execute from the configuration file, and you can’t manually put it into the file like other Linux distributions.

特别谢谢您!! 我终于可以鞋子中文了!

I confirm that the code linked in by @qkzy worked for me in Hyprland 0.36

好像是fcitx5-rime包缺少rime-data导致的问题。指定添加rime-data包可以解决。

  i18n.inputMethod = {
    enabled = "fcitx5";
    fcitx5.addons = with pkgs; [
        rime-data
        fcitx5-rime
        fcitx5-gtk
    ];
  };

2 Likes