fcitx / mozc

Mozc - a Japanese Input Method Editor designed for multi-platform
Other
114 stars 11 forks source link

How does the plugin communicate with mozc? #43

Closed musjj closed 12 months ago

musjj commented 12 months ago

I'm trying to make a modular package for Nix, one for mozc and one for fcitx5-mozc. But I'm having a problem with the mozc input method not working (typing doesn't trigger any candidates or popups).

I suspect that the fcitx5-mozc is unable to find either the mozc_server or mozc_tool binaries. I tried putting the path to the lib directory of the mozc package into the RUNPATH of fcitx5-mozc.so, but it doesn't work either:

$ readelf -d ~/.nix-profile/lib/fcitx5/fcitx5-mozc.so
...
 0x000000000000001d (RUNPATH)            Library runpath: [/nix/store/v7nzxbf4kkxzbi31c46wg7gnzvfxga3i-
 fcitx5-mozc-unstable-2023-08-18/lib:/nix/store/d9p0fdw2qfb013mb5a689a6wng6z2j0j-mozc-unstable-2023-08-18/
 lib:/nix/store/6ds58v5q1j1s4n0r6m9sb4n4iwqwrswa-fcitx5-5.0.23/lib:/nix/store/
 ibp4camsx1mlllwzh32yyqcq2r2xsy1a-glibc-2.37-8/lib:/nix/store/4igdc32rmnijcra8y3r1h42987ghzag2-gcc-12.3.0-
 lib/lib]

Is there a way to make sure that fcitx5 can find the path to mozc?

wengxt commented 12 months ago

So, if you want to use a non-default path, you need to do that at compile time.

Right now mozc has two build system.

If you use gyp, you need to pass --server_dir=/directory/name to build_mozc.py If you use bazel, you need to modify src/config.bzl and point things to the correct directory, speicifically, LINUX_MOZC_SREVER_DIR.

You can take https://github.com/fcitx/flatpak-fcitx5/blob/21d3c2334115880adddf9fbf5320a549aa872fa9/org.fcitx.Fcitx5.Addon.Mozc.yaml#L27C11-L27C49 as a reference.

musjj commented 12 months ago

That worked perfectly, thanks!