GNOME Bugzilla – Bug 112099
There should be a better way for third party input methods to make themselves known to gtk+
Last modified: 2013-08-14 00:55:43 UTC
To the best of my knowledge, for a third party input method to show up in the Input Methods menu, it can either a) overwrite /etc/gtk-2.0/gtk.immodules or b) write its own version of gtk.immodules and ask the user to set the environment variable GTK_IM_MODULE_FILE Both of these kinda suck. One possible solution would be to use a /etc/gtk-2.0/immodules.d/ directory where third party modules could drop their foo.immodules. Then GTK_IM_MODULE_FILE could be done away with and replaced with GTK_IM_MODULE_PATH.
What's wrong with writing a new copy of /etc/gtk-2.0/gtk.immodules? It's just a "cache" of the results of querying the input methods in the input method directory.
- you're not supposed write outside ${prefix} - you're not supposed to write over something installed by a different package - I don't see a clean way to avoid overwriting information previously written by other third party IMs
/etc/gtk-2.0/gtk.immodules is *not* owned by GTK+, any more that /usr/share/fonts/fonts.cache-1 is owned by fontconfig. gtk-query-immodules > /etc/gtk-2.0/gtk.immodules Should be thought of as similar to 'fc-cache'. If the user wants to use a custom setting of GTK_PATH and doens't have write access to /etc/, they have to set GGTK_RC_TOKEN_IM_MODULE_FILE=~/.gtk.immodules, but I dont' think that's too bad. I suppose we could automatically use ~/.gtk.immodules if found, though that causes some other possible problems. (It might have out-of-date contents)
I agree that gtk-query-immodules plays a similar role as fc-cache. But probably an even better parallel is with gst-register from GStreamer. They too used to put their cache in /etc, but since it's not user-editable they moved it to /var. Note also that gst-register can be run either as root or as a user. If it's run as root, it dumps the cache in the system location. If it's run as a user, it goes into ~/.gstreamer. You can also specify which paths to search for plugins. This is ideal, in my opinion. So in essence i think it would be best if gtk-query-immodules was changed to put its information in /var, and to easily allow the user to specify the search paths. Just doing the former would satisfy my main complaint.
We put the cache next to the modules themeselves in /usr/lib/gtk-3.0 now