The whole X11 input stack is a mess. First of all, you don't need any special input method framework if you're just typing latin characters or multi-character compose sequences as defined by your XKB keyboard layout. Strictly speaking, any multi-key sequences, such as dead-keys, require a very simple input method. But they are provided by libx11/XKB and work without any additional IM framework. So it is perfectly fine to uninstall all of ibus, uim, fcitx or whatever input method you have if you don't need to type languages such as Chinese or Japanese.
As you already said, Gnome made ibus the default input method, a decision not everybody was happy about. There are many people who prefer fcitx (which seems to be the default for most KDE distributions) over ibus for several reasons: be it proper language support (mostly Japanese vs. simplified vs. traditional Chinese) or performance issues. Since I don't speak any eastern languages which need a special IM framework, I can't really add anything to that debate. But if you are interested in more details about fcitx vs ibus, you may want to read this slightly dated (2012), but probably still accurate LWN article.
However, the fact that ibus is the default IM for Gnome doesn't make it obligatory. You can use any other input method you like or none at all. The IM configuration is done via environment variables. But except for when you're solely using GTK+ applications (which I doubt), you should set more than just
GTK_IM_MODULE. The proper way of setting an input method is:
in case of fcitx or
in case of ibus. uim works in the same way. If you want to explicitly disable any input method, use these settings:
An empty string works as well.
You can set these variables either system-wide in
/etc/profile (or a dedicated file inside
/etc/profile.d, respectively) or inside your local
~/.xprofile. Setting it in
~/.profile will not ensure that the lines will be executed when logging into your system using a graphical login manager such as GDM, SDDM, KDM or LightDM. If you are starting your X session using XDM, Slim or
startx, you need to put those lines in
If you configured an input method other than ibus, go to Gnome settings afterwards and make sure any ibus-related settings are disabled, especially any keyboard shortcuts. Alternatively, tell Gnome not to touch your keyboard settings using:
gsettings set org.gnome.settings-daemon.plugins.keyboard active false
or uninstall ibus altogether.
Now what about XIM? XIM is a pretty obsolete input method protocol which both ibus and fcitx implement for legacy support reasons only. There is no real reason why you would want to use XIM nowadays over any of those two. The only reason why you would want to set
GTK_IM_MODULE="xim" is to override GTK's hardcoded ComposeKey settings.
To answer your other question: I don't think there is really a way of detecting which input method is active at the moment except for looking at the environment variables or knowing which IMs are installed on your system. If
GTK_IM_MODULE is not set, GTK selects a built-in IM on the basis of configurations in
/etc/gtk-2.0/gtk.immodules. GTK 3.0 looks in
/usr/lib/gtk-3.0/3.0.0/immodules.cache which is generated by
The reason why
GTK_IM_MODULE is set to
xim is probably some stray variable definition somewhere in
/etc/profile.d/* or any other of your local or global shell RC files. Feel free to unset or override this variable if you feel the need to do so.
However, according to this Gnome bug report comment I assume that the value configured via
gsettings overrides the value set in
GTK_IM_MODULE for DBus-activated applications. So at least your Gnome applications are probably using
gtk-im-context-simple at the moment which effectively means standard behavior (i.e. no ibus or any other dedicated IM).