I’m using ibus to give me XCompose in Gnome (because the built-in compose set is too limited). This works for everything except one app.
From some investigation, it appears that this app gets launched via DBUS when launched from either Gnome Shell or Synapse. When run from the command-line as the path to the binary then ibus works. This appears to be because DBUS cleans the environment variables, which means that it doesn’t pass GTK_IM_MODULE through. Oddly, though, /proc/[pid]/environ does include QT_IM_MODULE.
I’ve tried adding “export GTK_IM_MODULE=ibus” to various files (.profile, .sessionrc, .xim.template, .gnomerc, .bashrc) but it doesn’t have any effect.
How can I get DBUS to export GTK_IM_MODULE so that any DBUS-launched apps have my correct input method to allow XCompose?
A general suggestion,
Instead of modifying individual apps (particularly so many of them and I don’t know if what you did actually was correct unless you post details), you might consider setting as a global environmental variable by modifying your profile.
If you open the existing /etc/profile, you’ll see instructions not to modify this existing file but to create a new file “/etc/profile.local” containing your settings.
An alternative is to create a script in /etc/profile/ containing your variables.
Remember that adding or modifying settings using one of the above “profile” methods only enables the setting to take effect on startup… If you want the setting to take effect immediately, you need to source the file… otherwise just reboot.
Sorry, I’m confused. What I’m editing are user-wide settings (.profile, .xsessionrc, .xim.template, .gnomerc, .bashrc, etc), not specific programs. I’m not trying to make each app use “ibus” for input individually, because that’d be crazy. The whole point of those various user-wide settings files is that they set the right variables for all apps in your session (but for different situations).
Having said that, I have considered editing the .desktop file for the one app that doesn’t get the GTK_IM_MODULE variable (and hence doesn’t get XCompose support) but I wanted to do it properly.
I could edit the master equivalents of all of the config files that I’ve edited (like /etc/profile or its equivalent) but a) that would apply it to all users, not just me, and b) it’d be outside my home directory so it would get lost at re-install.
As the files are my user files then I’ve been logging in and out as I make changes. From investigating the app then I’m almost certain it uses DBUS to launch (the process has an extra argument that isn’t in the .desktop file, and it is an argument that DBUS apparently adds, and the .desktop files also contains “DBusActivatable=true”) and DBUS strips the environment back to a limited set of values for “consistency”. I just can’t work out why QT_IM_MODULE is set in that environment while GTK_IM_MODULE isn’t, and how to make it carry through/load.
If you’re setting unique environmental variables that are common across many apps, you can certainly set the same variable in each app, but you can also set the variable system-wide which is is what my suggestion does.
Just suggesting a way that could save work setting the same thing over and over again in multiple apps, and it would require closer inspection but <might> address your final question by loading the variable in your system without requiring an app to load.
When you configure profile.local or create a file in /etc/profile, those are special procedures that ensure your settings survive an in-place upgrade/install, the only install those settings won’t survive is a “pave and install” (reformat) (and should be “of course”).
I’m still confused about where the talk of setting variables for individual apps comes from. I’ve not tried setting variables for individual apps, I’m trying to set variables that affect all apps, but one app in particular is being launched in a different way (via DBUS, rather than as a sub-process of my session) and so it is missing the variable I need, despite me having put that variable in every file I can think of and have read about!
I understand about setting environment variables, and how they’re done locally in various files within my profile, and my understanding of the master files in /etc is that you should (generally) never have to touch them unless you absolutely want everyone to have that variable, because everything that can be done in those files should be able to be done from your profile.
I’ll try to give it a go at some point, but as the issue appears to be DBUS stripping the required variable out of my environment then I’m not convinced it’ll work (and if it does work then I can’t help but feel that there should be another way that I can configure it that is more “correct” for the “affects only a single user” setup).
Sorry, I kept meaning to try this and never got round to it (because it was something that involved rebooting, and I never remembered about the issue until I was in the middle of doing stuff, at which point I didn’t want to have to keep rebooting to see if I’d fixed it!)
I’ve finally found the correct fix, and it was quite simple:
For reference, I worked out what it was after grepping /etc for “QT_IM_MODULE” and finding /etc/X11/xim.d/ibus and wondering whether I could set my own xim settings, then I realised I had a template but not an actual file!