Proposal: Using update-alternative to switch input method
Fuminobu TAKEYAMA <[email protected]> Fri, 25 Feb 2022 00:22:28 +0900
| Newsgroups | gmane.linux.suse.m17n |
|---|---|
| Message-ID | <[email protected]> |
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