Our computers can display an astonishing range of symbols. Unicode alone defines more than 150,000 characters, covering everything from mathematical operators and phonetic alphabets to emoji and obscure historical scripts. Our keyboards, on the other hand, remain stubbornly limited to a few dozen keys.
On Windows, the traditional workaround involves memorizing numeric codes or digging through character maps. Linux, being Linux, offers something far more flexible: XCompose. It’s one of those powerful, quietly brilliant features that’s been around forever, works almost everywhere, and somehow still feels like a secret.
XCompose is part of the X11 input system. It lets you define compose sequences: short key sequences that produce a Unicode character. Think of it as a programmable “dead key” system on steroids. This can be as simple as programming an ‘E’ to produce a Euro sign or as complex as converting “flower” into a little flower emoji. Even though the system originated with X11, I’ve been told that it mostly works with Wayland, too. So let’s look deeper.
Starting XCompose
The secret is the Compose or Multi-key. You press it to essentially escape into XCompose mode, so when you type “flower”, it knows you don’t want to insert those literal letters in. You can pick which keyboard key is your compose key in your system settings. The Right Alt or Ctrl key is a common choice. I use my Caps Lock key, since I never really use it for anything else.
You can set the Compose key in other ways, too, including in ~/.XCompose, but it is usually easier to set it in the system settings. However, ~/.XCompose is one place you can set up custom rules.
By default, though, you should have some useful combos. For example, <Compose> ' e it should give you é and <Compose> " o should give you ö. The default rules are in /usr/share/X11/locale/*/Compose, where the * is your locale of choice.
Customize
The defaults usually cover a lot of ground. But you may want to define your own. You can do that by creating or editing ~/.XCompose. This file can contain rules or include other rule files. I have heard, however, that Wayland doesn’t do includes, so if you use that, it is something to keep in mind.
The file format is simple enough, with each line being a definition:
<Multi_key><a><e> : "æ"
Don’t make the mistake of trying to write something like <@>. All the special characters need the names from X11’s keysymdef.h file like <at> or <asterisk>.
When you make a custom file, you’ll usually start with:
include "%L"
This tells the system to load the defaults for your locale. You can also use %H for your home directory or %S for the system directory. When using some systems, you may have to include “/%L” instead.
Formally, the configuration line looks like this:
<EVENT>... : <RESULT> # comment
The <EVENT> allows you to not only specify keys but also modifiers that must be or must not be present. The <RESULT> can be a string or a character, and you can even insert an octal or hex number to be sure you get the key you want. For more, read the man page.
It is worth noting that any definition you provide will override the system ones, so if you don’t like something, it is easy to redefine it to something else. One nice thing is that the result doesn’t have to be a single character. You can use an entire string system. So:
<Multi_key> <c> <q> : "CQ de WD5GNR K"
As far as I know, there’s no way to embed a newline in the result that always works. You can try using something like \xa, for example, but \n doesn’t work. Also, no substitutions work on password/PIN entry, and that’s by design.
Why Build Your Own?
You can build up strings that make sense to you. But you know someone’s already done it. The repo has a core file of interesting definitions and some extra ones, too. My suggestion: don’t use their install function, which only gives you the core. Just create your own file like this, adjusting for wherever you put the files:
include "%L" include "/home/xxx/xcompose/dotXCompose" include "/home/xxx/xcompose/frakturcompose" include "/home/xxx/xcompose/emoji.compose" include "/home/xxx/xcompose/modletters.compose" include "/home/xxx/xcompose/parens.compose"
Keep in mind that when you change this file, it will only apply to GUI apps you started after the change. Try <Compose> : ) to get ☺among others.
And if you don’t like that collection, there are others.
Some Common Use Cases
Music? Try ♭ (#b) or ♯ (##). You can even make notes like ♪ (#e). Prefer math? How about ≠ (/=) or a square root symbol √ (v/). If your math runs more to accounting, you can write about Euros (€ – =E) or Yen (¥ – =Y). Hams will appreciate /O which produces Ø (note, that is an upper case O on the input).
There are plenty of other ones, too. The best way to know is to look in the files you are using and experiment.
<Multi_key> <3> <3> : "¯\_(ツ)_/¯" # Shrug
It is easy to code up things like your name, your e-mail address, and more. Since you can use names instead of cryptic keystrokes, it is much easier to use. For example, I forget that my name is on Macro+F5, but <Compose>@name is easy to remember. I find it makes it easy to remember if I prefix all (or most of ) my personal commands with some character like “@.” So I might have @name, @add, @tel, and @email, for example. Just don’t forget, the actual rules have to use the key names:
<Multi_key><at><n><a><m><e>:"Al Williams"
Some applications, notably GTK apps, won’t work with XCompose without some tweaking. In particular, you may need to override the default input method. If this problem bites you, a quick search for “XCompose and GTK” should give you some advice. There’s always a chance your app, or even some input fields in your app, won’t work with XCompose. That’s life.
What It Isn’t
Keep in mind that XCompose only works in the GUI. It isn’t context-aware. It doesn’t allow you to insert multiple lines. If you need scripting and other advanced features, this isn’t the right place to be. Want to just map keys sometimes? You can do it, but not with this tool.
But for nearly universal keyboard remappings, it works quite well, once you get used to the syntax. Have a favorite line in your .XCompose? Share it in the comments!

So it’s like AutoHotkey but more cumbersome? Meh.
I’d say it’s closer to Alt codes in Windows, but with the ability to assign them a mnemonic rather than a simple number. typing Bell instead of just pressing 7 and getting a • character etc.
It’s like Alt codes, but you have to define them yourself before it does anything, and the codes are not standard across systems so it’s actually quite useless.
Nice.
But to think all we really need is the standard 128 ASCII chars for everything we do with computers to get answers. Perfectly readable by everyone. :sigh: :)
Context aware AI keystroke generator would be more useful given my short term memory.
this is best keyboard https://klawiatura.wordpress.com/
It’s probably a niche thing, but I find it super useful. Cannot agree more about the useless caps lock key!
I often have to switch between languages (mostly English, German and French) and it’s convenient to be able to type accented letters without having to change the whole keyboard layout.
Also useful are Greek characters, for example for typing resistor values in Ω.
As a side note, a similar tool exists for Windows, called WinCompose.
hahaha i feel the strength of your flex, putting an ohm in your comment as easily as i type ohm ohm ohm. nicely played!
I found a version of the compose system for Windows 3.1 once. I gave it to my father who was using Windows 3.1 on an antiquated computer to write a book. He was a mediaeval historian and needed a lot of accented characters for his work. He was notoriously bad at learning anything technical but he took to the compose system very well.
I had a Compose key systray daemon installed in Windows 7, I think it worked in at least Win10 as well. Not sure about 11. As on Linux, I used the Menu key as my Compose key. It’s a good choice because, like Caps Lock, it’s not a modifier. (Compose isn’t used like shortcuts — you don’t hold the key while you type the sequence, you just type it to initiate compose-entry mode.)
Windows also has IME, an input system for other scripts like Chinese and Japanese hiragana and katakana. You can type in the Hepburn romana writing and it will turn it into the corresponding kana and lets you pick the kanji based on that. Not sure if Linux has something similar to this but I guess xcompose can be used for this.
https://wiki.archlinux.org/title/Input_method
Using xcompose as an IME sounds diabolical
The iPhone keyboard (and Droids too, I assume) makes it easy to type special characters just by holding the key. I never use auto repeat. Why can’t there be something similar for the Linux keyboard?
Mac does it, feels inefficient on desktop