Comment 21 for bug 1551283

Hey Gunnar,
  Thanks for looking further into this.
>> however I did notice your use of XDG_CURRENT_DESKTOP is not
>> consistent with the spec.
> Thanks for mentioning that. Then I suppose that replacing
>
> "$XDG_CURRENT_DESKTOP" != 'GNOME'
>
> with
>
> "${XDG_CURRENT_DESKTOP%%-*}" != 'GNOME'
>
> takes care of it.
well that assumes that there is a hyphon in the name, while that is the case for the ones I know of, its not necessarily guaranteed. Thus:

"${XDG_CURRENT_DESKTOP##*:}" should be safer, GNOME (or Unity) should always be last since its essentially a fallback value
>
> I have now installed Ubuntu GNOME and made some observations:
>
> On a fresh Ubuntu GNOME 16.04 install I added the Japanese language
> including the suggested language support. For me it pulled exactly the
> same packages as gnome-language-selector would have done, so there is no
> reason to install gnome-language-selector for that reason.
As expected, since we get the list of packages from language-selector-common using PackageKit
>
> After having logged out and logged in again, I found "Japanese (Mozc)"
> among the input sources and added it. Then I could open gedit, select
> "Japanese (Mozc)" and type beautiful characters: 絵画井笥 :) (Mozc is pulled
> in 16.04; previously it was Anthy. But I installed ibus-anthy manually,
> and could type Japanese with Anthy too.)
>
> Then I changed the display language to Japanese, and now it was broken.
> Some of the IM related environment variables had been set to fcitx (even
> if XMODIFIERS and QT_IM_MODULE had been set to ibus by gnome-session)
> and fcitx had been started by im-config. After having commented the
> setting of the IM_CONFIG_PREFERRED_RULE variable in /etc/default/im-
> config, I could type using IBus also with Japanese as the display
> language.
>
> (I failed to change the display language with Region & Language, and had
> to do it manually. However, using Region & Language for the purpose
> worked after I had used gnome-language-selector to switch language once,
> and thus created ~/.pam_environment and set the "Language" and
> "FormatsLocale" values in /var/lib/AccountsService/users/gunnar!? But
> that's a separate issue.)
Does gnome-control-center need to create ~/.pam_environment? I didn't think that is used upstream, but specific to Ubuntu patched
accountsservice so maybe we will have to patch it for that?
>
> So one conclusion is that im-config should indeed not set
> IM_CONFIG_PREFERRED_RULE on Ubuntu GNOME.
This makes sense
> It's also clear that if users shall have a chance to use fcitx, gnome-
> session must not set those variables. (But this is probably not the most
> urgent thing right now.)
It would be good to allow users the option of using fcitx (even if poorly integrated), however lets just get the default session working for now!
>
> I played with user specific im-config settings using the "Input Method"
> GUI. IBus typing seems to work with any of the values "none", "xim" and
> "ibus", since two of the IM related environment variables are set by
> gnome-session anyway. Can't help feeling that "ibus" (i.e. in accordance
> with the current proposal in the PPA) is the safest and most sensible
> choice, though.
"ibus" seems most sensible to me also.
>