Japanese input in 2023/2024

How can I get Japanese input, preferably with anthy, to work with either home manager, or configuration.nix? I’m trying all sorts of things, but I’m just not able to get it to work. Right now I am trying home-manager with:

18n.inputMethod.enabled = "fcitx5";
i18n.inputMethod.fcitx5.addons = with pkgs; [ fcitx5-configtool fcitx5-anthy ];

doesn’t work. I can add a Japanese keyboard but I’m unable to switch to Japanese input. No kana to be found.

I’ve also tried my configuration.nix:

  i18n.inputMethod = {
    enabled = "fcitx5";
    fcitx5.addons = with pkgs; [
      fcitx5-anthy
      fcitx5-gtk
    ];
    ibus.engines = with pkgs.ibus-engines; [ anthy ];
  };

But this also does not work.

You’d think that anthy would work since it exists in nixpkgs, but so far no luck. Any light on this? Please shine it :laughing:

Found the solution (of course just one minute after asking the question) so here it is the trick for those looking it up later:

in fcitx5-config-qt (what I am using), don’t add the Japanese keyboard but simply add the mozc or anthy keyboard. They both work for me, but visually mozc is a little bit nicer because the kanji suggestions of anthy are a bit too small.

So that’s the trick. Fixed!

As another reference, here’s my config: https://github.com/infinisil/system/blob/07534666e0592d9ceb1fc157dc48baa7b1494d99/config/modules/japanese-input/default.nix :slight_smile:

And you can run fcitx5-configtool to configure some stuff. Not sure if that’s the default but to switch inputs I use Ctrl-Shift

2 Likes

Thank you! That helps me when I am going to try to setup kitty later on.

I setup a config similar to yours @Infinisil but I’m not seeing mozc in the list of languages.

Here is mine for reference.

{pkgs, ...}: {
  config = {
    i18n.inputMethod.enabled = "fcitx5";
    i18n.inputMethod.fcitx5.addons = [
      pkgs.fcitx5-mozc
      pkgs.fcitx5-gtk
      pkgs.fcitx5-configtool
    ];

    # Would normally set this to fcitx, but kitty only supports ibus, and fcitx
    # provides an ibus interface. Can't use ibus for e.g. QT_IM_MODULE though,
    # because that at least breaks mumble
    environment.variables.GLFW_IM_MODULE = "ibus";
  };
}

Ah so I had to reboot before mozc showed up in fcitx5-configtool. I was trying things out with rebuild test but it wasn’t working until I did a rebuild switch and rebooted.

Now the only thing to figure out is why the tab window for alternative kanji isn’t showing up in kitty.