Wayland and fcitx5 (japanese input)

Does anyone here have a working setup for fcitx under wayland? I currently have

  i18n.defaultLocale = "en_US.UTF-8";
  i18n = {
    inputMethod = {
      enabled = "fcitx5";
      fcitx.engines = with pkgs.fcitx-engines; [ mozc ];
      fcitx5.addons = with pkgs; [
        fcitx5-mozc
        fcitx5-gtk
      ];
    };
  };

and

    extraSessionCommands = ''
      # https://www.reddit.com/r/swaywm/comments/i6qlos/how_do_i_use_an_ime_with_sway/g1lk4xh?utm_source=share&utm_medium=web2x&context=3
      export INPUT_METHOD=fcitx
      export QT_IM_MODULE=fcitx
      export GTK_IM_MODULE=fcitx
      export XMODIFIERS=@im=fcitx
      export XIM_SERVERS=fcitx

and I can start fcitx5 just fine and configure it but the input selection switch won’t show up under e.g., Alacritty and Firefox. I can make it work for Alacritty by starting with WAYLAND_DISPLAY= alacritty but that doesn’t seem like a sustainable workaround since it messes with other display settings.

Should I just give up on Japanese input on Wayland in at least browser and terminal?

2 Likes

I can confirm that this is not working for Gnome + Wayland. Did you manage to get it working now?

I have since switched back to X because I couldn’t get it to work

1 Like

FWIW ibus-mozc works reliably on GNOME + Wayland.

    i18n = {
      inputMethod = {
        enabled = "ibus";
        ibus.engines = with pkgs.ibus-engines; [ mozc ];
      };
    };
1 Like

Tried Wayland again today with the same configuration as before and there’s no change, it still doesn’t work at all for me.

I am happy to report that I now have the input box from fcitx5 appear in Firefox and Alacritty. I’m not sure what caused it to work and I’m reluctant to invest time to figure it out. I suspect that it was caused by an update to Alacritty, although it could also be an update to any other part of my system related to it.

In the case of Firefox I switched to firefox-wayland. I didn’t think this would make such a huge difference but in fact it fixed way more than just the missing input box. Before that, typing in Firefox would feel incredibly janky and sometimes key presses didn’t seem to be registered. Or rather, I’d type something, nothing would happen, and suddenly everything I typed would appear on screen. A bit like a video that freezes and then the part you missed is replayed almost instantly.

Here’s my configuration.nix

1 Like