Customize compose key sequences

The compose key comes in very handy composing characters normally not directly available from the keyboard. For instance, pressing the compose key followed by a «c» and an «0» delivers © at the cursor. What about adding sequences that doesn’t exist?

This post is written using Ubuntu 19.10. There are many (older) pieces of information, questions and answers about how one could add new compose sequences. Some work, some don’t. Many are outdated or specific to an input method or framework someone is using.

Ubuntu uses something that is called ibus by default. Don’t ask me how it relates to xim, xinput and other open source desktop software. I do know that after a bit of research, ibus reads te file ~/.config/ibus/Compose which would be our place to put our compose sequences.

This file has a specific syntax, see man Compose for more information. For example:

<Multi_key> <v> <v>  : "✓"
<Multi_key> <x> <x>  : "✗"

Use $ ibus restart to make your changes take effect. You could try removing your ~/.cache/ibus directory when it doesn’t work right away.

Bonus tip: with CTRL+Shift+e – space, you can select any smiley you want. Type joy before pressing space and you can walk through all relevant emoticons that contains ‘joy’.






Leave a Reply

Your email address will not be published. Required fields are marked *