Hi,

the update-alternative approach needs to adjust every ibus/fcitx/fcitx5 package and write their own generator scripts…it may be too hard for an input method framework maintainer to know everything about systemd…

Currently my generator supplements systemd and a dummy “inputmethod” package, so any package provides “inputmethod” can use this generator.

The $LANG and .i18n can be added later, it’s easy actually.  After these works, I think maybe we can remove Provides: lang(zh:ja:ko) tags from packages too.

actually this time I made the request  just to split the generator from fcitx5 to benefit others, with no other further design/considerations, and I know the generator is just a skeleton now :-)

Marguerite 

Fuminobu TAKEYAMA <ftake@geeko.jp>于2022年2月24日 周四23:22写道:
Hi Marguerite and all,

Thank you for working to support IM on Wayland sessions.

I see your systemd-inputmethod-generator.
https://build.opensuse.org/package/show/M17N/systemd-inputmethod-generator

It simply read a list of input methods and precedence from
(/usr)/etc/X11/xim.d/en. I think it is ok nowadays since we do not need complex
mechanisms provided by /etc/X11/xim anymore.

But I'm wondering how about using `update-alternatives` instead of reading
/etc/X11/xim.d/en. A benefit of using update-alternatives is users can choose an
input method by `update-alternatives --config` or YaST. `update-alternatives` is
also used to configure a default display manager.

To use update-alternatives, firstly, we prepare:
[1] /usr/lib/input-method/user-environment-generators/fcitx
[2] /usr/lib/input-method/user-environment-generators/ibus

And run `update-alternatives --install` during installation:
update-alternatives --install \
    /usr/lib/systemd/user-environment-generators/29-input-method-generator \
    input-method-user-environment-generator \
    /usr/lib/input-method/user-environment-generators/fcitx \
    25

The following symlink to one of above will be generated:
/usr/lib/systemd/user-environment-generators/29-input-method-generator


Note that if [1] and [2] does not contain any program, the file managed by
`update-alternatives` can be /lib/environment.d/99-input-method.conf


What do you think?

If you plan to extend your input-method-generator so that it can read
/etc/X11/xim.d/$LANG and/or ~/.i18n, etc., the current approach will be appropriate.


a related report:
https://bugzilla.opensuse.org/show_bug.cgi?id=1084804

Best regards,
Fuminobu Takeyama