Ubuntu – How to add a custom compose key sequence

compose-keykeyboard-layout

How can I add a custom compose key sequence?

For example, I would like Compose, |, > to type the symbol.

I have tried adding the following to ~/.XCompose:

# Import default rules from the system Compose file
include "%L"

# Custom definitions
<Multi_key> <bar> <greater> : "▸" U25B8 # Black right-pointing small triangle

but the new sequence is not usable anywhere except for xterm.

Installing ibus-table-compose and then enabling the Compose input method in IBus did not solve the problem; IBus imitated many compose key sequences, but not the one I had created.

Best Answer

Create a file ~/.XCompose (that is a file named .XCompose in your "home" folder) which contains the following:

include "%L"   # import the default Compose file for your locale
<Multi_key> <bar> <greater>     : "▸"

See man 5 Compose for more info about the format of this file.