The answer is the ~/.XCompose file. Start by copying the default compose file (/usr/share/X11/locale/en_US.UTF-8/Compose for me) to ~/.XCompose, and then edit it to add any additional sequences that are desired. (You can also remove any sequences you don't use, though it's not clear whether there's any benefit to this. For example, I removed all "dead key" sequences)
Applications seem to read this file once at startup, so my testing generally involves opening a new urxvt to verify the sequence works and inserts the desired character.
The Character Map applet is quite useful for finding the desired characters.
Make sure your text editor is using the right character encoding (typically UTF-8).
Here are some of the sequences I've found it useful to define:
<Multi_key> <i> <n> <f> : "∞" <Multi_key> <p> <i> : "π" <Multi_key> <o> <h> <m> : "Ω"
It's also worth noting that you can define compose sequences that result in entire strings:
<Multi_key> <m> <e> : "Jeff Epler <firstname.lastname@example.org>"
Update, May 2011: By default in certain locales including the en_US
locale, gtk+ uses its own hardcoded list of compose sequences. To get
~/.XCompose support in gtk+ applications, arrange to set GTK_IM_MODULE=xim in
the environment. Related: gnome bug 96053, where I found the answer
for how to get gtk/gnome apps to behave.
Entry first conceived on 1 February 2011, 16:33 UTC, last modified on 3 October 2013, 13:14 UTC
Website Copyright © 2004-2021 Jeff Epler