Pinyin input method in Hyprland / Wayland for Simplified Chinese

I have been trying to install a pinyin input method in Hyprland.

But I can only make it work for Traditional Chinese, not Simplified Chinese.

Inspired by this post, the following works for Traditional Chinese:

# Works for Traditional Chinese
{ config, pkgs, ... }:
{
  i18n.inputMethod = {
    enabled = "fcitx5";
    fcitx5.addons = with pkgs; [
      rime-data
      fcitx5-gtk
      fcitx5-rime
      fcitx5-chinese-addons
    ];
  };
}    

Some additional tweaks for Hyprland’s configuration were necessary to activate the keyboard input selector:

# ~/.config/hypr/hyprland.conf
windowrule = pseudo, fcitx
exec-once=fcitx5 -d -r
exec-once=fcitx5-remote -r   

Specifically, fcitx5-rime mainly supports Traditional Chinese, giving me a “Rime” choice in fcitx5-configtool.

If I simply remove it from the list of addons, and I run fcitx5-configtool, there are no options to choose Simplified Chinese:

# Doesn't work for Simplified Chinese
{ config, pkgs, ... }:
{
  i18n.inputMethod = {
    enabled = "fcitx5";
    fcitx5.addons = with pkgs; [
      fcitx5-gtk
      fcitx5-chinese-addons
    ];
  };
}

Even if I try to type, after switching to this generic Chinese keyboard, no pinyin input method is activated.

What can I do to get Simplified Chinese in Hyprland / Wayland?

I seem to be missing

  • An simplified option in fcitx5-configtool (see screenshot below)
  • A pinyin pop-up thingy when typing

I tried libpinyin as shown below, but it also doesn’t work.

# Does not work
{ config, pkgs, ... }:
{
  i18n.inputMethod = {
    enabled = "ibus";
    ibus.engines = [ pkgs.ibus-engines.libpinyin ];
  };
}

After digging in a hidden Reddit comment that suggests I search for “cn” in fcitx5-configtool rather than “Chinese”, a “Pinyin” option occurs under “简体中文”:

This finally makes the pinyin menu work.

My complete setup is like this:

# import this into configuration.nix
{ config, pkgs, ... }:
{
  i18n.inputMethod = {
    enabled = "fcitx5";
    fcitx5.addons = with pkgs; [
      fcitx5-gtk
      fcitx5-chinese-addons
      fcitx5-nord
    ];
  };
}

Additionally,

# ~/.config/fcitx5/conf/classicui.conf
Theme=Nord-Dark
Font="Meslo 28" # Where's my glasses?

1 Like