X11 Compose Key – How to Find Out if ~/.XCompose File is Loaded

compose-keyx11

I've added a simple sequence, but it won't work.
How can I find out if the OS (Ubuntu 12.10 with Unity) is actually loading the file?

Best Answer

The compose definitions ($XCOMPOSE, ~/.XCompose or a file under /usr/share/X11/locale) are loaded by each client application, not by the X server. So make sure that the application you're testing with is loading ~/.XCompose. You can see what files it's reading with strace:

$ strace -e open,openat xterm |& grep Compose
open("/home/gilles/.XCompose", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/X11/locale/en_US.UTF-8/Compose", O_RDONLY) = 5
$ touch .XCompose
$ strace -e open,openat xterm |& grep Compose
open("/home/gilles/.XCompose", O_RDONLY) = 5

Most applications only load the file when they start, so you'll have to restart the application if you change your compose definitions.

If the application is not loading these files, it's likely that they're not using the 'X input method' (xim). You can force GTK or QT applications to use xim:

$ GTK_IM_MODULE=xim QT_IM_MODULE=xim strace -e open,openat xterm |& grep Compose

If this fixes the problem, then you should consider setting the environment variables globally, or use alias as a workaround on a per-app basis.

Related Question