August 12, 2018
If you love the simplicity of a QWERTY keyboard like I do, but have to type special characters like the German ä or the Spanish ç from time to time, it can be pretty annoying to have to switch between keyboard layouts over and over, stepping on a foreign land for one second, only to jump back to your comfort zone the next. Not long ago, I was introduced the “compose key” the first time at a local meetup - now I can’t live without it!
Frankly, the US QWERTY just doesn’t have all the letters a multilingual like you wants to type.
If you have grown up with the classic US layout like me (US layout happens to be the most popular one in China), and currently live in a foreign country where an extended Latin alphabet is used, you might find it super cumbersome for constantly switching keyboard layouts back and forth only to type a few special letters. One solution would be simply opt for a local layout - which was exactly what I did when I first got here in Germany (which is an awesome country with free college, even for expats 😃).
However, I had to change back to the US layout later, when I switched to computer science as my major and got serious with programming. The German QWERTZ layout just doesn’t feel like to be built for typing Punctuation marks, at least it was too hard to get used to for me! 😛 So, I came back to live the discomfort of switching between German and English layouts on a US keyboard, but at least I can type code faster then - an acceptable trade-off!
But who likes trade-offs if we can have them all?
The idea of compose key is simple: compose different characters together! Well, technically it’s not really composing characters, but dialing in the precomposed instead.
To get the “lost” compose key back, you’ll have to sacrifice a normal key. Fortunately, the
PrtSc key is present on most keyboards, and doesn’t seem to be used much - you are definitely going to use the compose feature more often than taking screenshots, and you can always assign a key combination for the latter. On Linux with XFCE desktop environment, you simply need to open the keyboard settings app and you will find the compose feature just sitting there waiting for you to enable. 😉
Well, how does it actually work? Simple, just consider how you’d write those special letters in real world!
For example, if you would like to compose two horizontal dots and
O together, you can do it with
" to trigger the two dots, then just type the normal
O on your US keyboard - voilà! You’ve got the German
Ö! Oh, by the way, you can type
à by simply
` and the normal
a! (Note: You can don’t have to use
<Compose> key as a modifier key, just hit it as if you are typing a sequence of letters normally.)
Pretty intuitive huh?
For money, you can type
= c, or type
- L. For science, you can type
+ -. For fun (or for the party), you can even type
☭ with a swift combination of
<Compose> C C C P! Some combinations might not work inside certain programs (
♪ in VS Code for example), but most compositions should work anywhere.
If you are not sure how to type certain characters and playing around doesn’t help, you can always find a complete list of “composable” characters of your keyboard locale at
/usr/share/X11/locale/<Your Locale>/Compose (mine is
en_US.UTF-8). You can also add new composition definitions! Native emoji input method, anyone? 😋