Re: Proposal: Using update-alternative to switch input method
Marguerite Su <[email protected]> Fri, 25 Feb 2022 12:32:31 +0800
| Newsgroups | gmane.linux.suse.m17n |
|---|---|
| Message-ID | <CAK0PdAmzBkxbwJKBn=j1O8u+AAJUGZF1tMfYO=R60wkQgTthpw@mail.gmail.com> |
--00000000000089f05705d8d030ad Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, the update-alternative approach needs to adjust every ibus/fcitx/fcitx5 package and write their own generator scripts=E2=80=A6it may be too hard fo= r an input method framework maintainer to know everything about systemd=E2=80=A6 Currently my generator supplements systemd and a dummy =E2=80=9Cinputmethod= =E2=80=9D package, so any package provides =E2=80=9Cinputmethod=E2=80=9D can use this= generator. The $LANG and .i18n can be added later, it=E2=80=99s 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 <[email protected]>=E4=BA=8E2022=E5=B9=B42=E6=9C=8824=E6=97= =A5 =E5=91=A8=E5=9B=9B23:22=E5=86=99=E9=81=93=EF=BC=9A > 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-generato= r > > 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 readin= g > /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-generato= r > \ > 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 b= y > `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=3D1084804 > > Best regards, > Fuminobu Takeyama > --00000000000089f05705d8d030ad Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto">Hi,</div><div dir=3D"auto"><br></div><div dir=3D"auto">th= e update-alternative approach needs to adjust every ibus/fcitx/fcitx5 packa= ge and write their own generator scripts=E2=80=A6it may be too hard for an = input method framework maintainer to know everything about systemd=E2=80=A6= </div><div dir=3D"auto"><br></div><div dir=3D"auto">Currently my generator = supplements systemd and a dummy =E2=80=9Cinputmethod=E2=80=9D package, so a= ny package provides =E2=80=9Cinputmethod=E2=80=9D can use this generator.</= div><div dir=3D"auto"><br></div><div dir=3D"auto">The $LANG and .i18n can b= e added later, it=E2=80=99s easy actually.=C2=A0 After these works, I think= maybe we can remove Provides: lang(zh:ja:ko) tags from packages too.</div>= <div dir=3D"auto"><br></div><div dir=3D"auto">actually this time I made the= request =C2=A0just to split the generator from fcitx5 to benefit others, w= ith no other further design/considerations, and I know the generator is jus= t a skeleton now :-)</div><div dir=3D"auto"><br></div><div dir=3D"auto">Mar= guerite=C2=A0</div><div><br><div class=3D"gmail_quote"><div dir=3D"ltr" cla= ss=3D"gmail_attr">Fuminobu TAKEYAMA <<a href=3D"mailto:[email protected]">f= [email protected]</a>>=E4=BA=8E2022=E5=B9=B42=E6=9C=8824=E6=97=A5 =E5=91=A8= =E5=9B=9B23:22=E5=86=99=E9=81=93=EF=BC=9A<br></div><blockquote class=3D"gma= il_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-lef= t:1ex">Hi Marguerite and all,<br> <br> Thank you for working to support IM on Wayland sessions.<br> <br> I see your systemd-inputmethod-generator.<br> <a href=3D"https://build.opensuse.org/package/show/M17N/systemd-inputmethod= -generator" rel=3D"noreferrer" target=3D"_blank">https://build.opensuse.org= /package/show/M17N/systemd-inputmethod-generator</a><br> <br> It simply read a list of input methods and precedence from <br> (/usr)/etc/X11/xim.d/en. I think it is ok nowadays since we do not need com= plex <br> mechanisms provided by /etc/X11/xim anymore.<br> <br> But I'm wondering how about using `update-alternatives` instead of read= ing <br> /etc/X11/xim.d/en. A benefit of using update-alternatives is users can choo= se an <br> input method by `update-alternatives --config` or YaST. `update-alternative= s` is <br> also used to configure a default display manager.<br> <br> To use update-alternatives, firstly, we prepare:<br> [1] /usr/lib/input-method/user-environment-generators/fcitx<br> [2] /usr/lib/input-method/user-environment-generators/ibus<br> <br> And run `update-alternatives --install` during installation:<br> update-alternatives --install \<br> =C2=A0 =C2=A0 /usr/lib/systemd/user-environment-generators/29-input-method-= generator \<br> =C2=A0 =C2=A0 input-method-user-environment-generator \<br> =C2=A0 =C2=A0 /usr/lib/input-method/user-environment-generators/fcitx \<br> =C2=A0 =C2=A0 25<br> <br> The following symlink to one of above will be generated:<br> /usr/lib/systemd/user-environment-generators/29-input-method-generator<br> <br> <br> Note that if [1] and [2] does not contain any program, the file managed by = <br> `update-alternatives` can be /lib/environment.d/99-input-method.conf<br> <br> <br> What do you think?<br> <br> If you plan to extend your input-method-generator so that it can read <br> /etc/X11/xim.d/$LANG and/or ~/.i18n, etc., the current approach will be app= ropriate.<br> <br> <br> a related report:<br> <a href=3D"https://bugzilla.opensuse.org/show_bug.cgi?id=3D1084804" rel=3D"= noreferrer" target=3D"_blank">https://bugzilla.opensuse.org/show_bug.cgi?id= =3D1084804</a><br> <br> Best regards,<br> Fuminobu Takeyama<br> </blockquote></div></div> --00000000000089f05705d8d030ad--