Originally published on peateasea.de.
Did you know that iBus can cause the compose key to stop working in X-Windows on Linux? I didnāt either. The solution in my situation: if in doubt, leave it out.
Iāve been using Unix and Linux systems since the mid to late 1990s. This is a long time and old habits die hard. Lots of old habits in the Unix world still work today and thus they still have value. As the saying goes, āif it aināt broke, donāt fix itā. Unfortunately, sometimes things break and itās hard to work out why they broke and thus how to fix them.
Today is one case in point. I wanted to create a Euro currency symbol in an email but the compose sequence Compose e =
didnāt work1. āHuh, thatās weirdā, I thought. I tried the sequence in a terminal, which had worked up until recently (unfortunately, I donāt know exactly when š). It didnāt work there either. Very weird. I noticed that when pressing the compose key, a strange symbol, in what looked like a small window, appeared in my terminal. āHang on, whatās that?ā, I thought.
A couple of hours disappear, my browser history is much longer, and I still donāt have that email finished. But I now know what was causing the problem and I have a fix for it. Yay!
Whatās the compose key?
But first: whatās this compose key thing heās talking about? This is one way to create characters which might not be available on your keyboard. Being someone from an English-speaking culture, when growing up I didnāt need umlauts or accents or Greek characters on my keyboard.2 There are, however, very many other characters one might wish to use. The people who construct computing systems worked out a long time ago (relatively speaking) that a standard keyboard had too few keys for all possible characters one might want to produce. They came up with an elegant solution to this problem: characters could be composed by using a special key in combination with the more basic characters available on a keyboard. This became known as the compose key3 and (at least until the late 90ās and probably early 2000ās) there was a special key on many keyboards specifically for this task.
These days people tend not to use DEC or Sun Microsystems desktop systems (which is where one would have seen such a key) and thus itās not obvious that a compose key could exist let alone realise that there might be a need for one. Since my standard keyboard doesnāt have an explicit compose key, I mapped caps lock to compose, because after all, who needs caps lock, right?
It doesnāt work! What, exactly, doesnāt work?
So, back to the issue at hand: the compose key wasnāt working. But what does ānot workingā mean in this case? Well, when I pressed the Compose e =
key sequence the Euro currency symbol didnāt appear as expected. Instead, after pressing the compose key, a white box containing a little symbol appeared under the cursor:
The image shows my terminal prompt (which starts on the line below the username, hostname and path information that I display in my shell) and the cursor (the tall white box next to the ->
arrow). Note that below the cursor, thereās a wide white box, with a grey shaded area to the left and within the white area thereās a symbol of some kind.4 Note how zoomed-in this image is. This is why it was very difficult to work out what the computer was trying to tell me and hence to work out what was going on. It seemed that this little pop-up box was stopping the compose sequence from getting to the shell and hence stopping the desired character from being displayed.5
This, I think, is the fundamental insight here: something was getting in the way and stopping the key presses from reaching the relevant (X-Windows) application. But what?
Trying to google for things like ālittle pop-up window when pressing compose keyā led nowhere and served only to confuse me and make my browser history even longer.
ā¦ I thought something might be wrong with my xmodmap
settings. Nope.
ā¦ I tried setting the XKBOPTIONS
variable in/etc/default/keyboard
and restarting X-Windows. Also nope.
ā¦ I even tried using a different windows manager.6 š±
ā¦ I tried rebooting and ā¦ hang on, what was that? As the windows manager was starting, I noticed a symbol appear in the taskbar that Iād spotted before, but didnāt know what what it was. It looked a bit like a picture of a steam iron. It turns out it wasnāt a picture of an iron (and I never thought it was, but still). That idea came from either my bad eyesight, the small size of the icon, or my imagination (or a combination of all three). The icon was, in fact, a keyboard with a cable above and a small globe of the earth in the lower left-hand corner.
Upon starting my first terminal session, this changed into just the two letters EN
; this is because I use an English-based keyboard layout.7
Iād seen this appear a few times over the years but it never seemed to have had any impact on my ability to enter text into the console or any GUI applications, so I paid it no further attention. I also noticed that the icon would sometimes disappear after a while. You know how one can be too busy to investigate that random thing which appears on oneās computer but later bites one on the proverbial posterior at some inopportune time? This was one of those times.8
Fortunately, this time, I decided I wanted to work out what this thing was and ended up right-clicking on the symbol, which greeted me with a context menu:
Clicking on the āAboutā menu item showed this window
Aha! Now I know what this thing is and can now create a more sensible Google query.
Extending my browser history (and the number of open tabs) further, I learned that the icon belonged to iBus, the āIntelligent Input Busā. This is an
input method (IM) framework for multilingual input in Unix-like operating-systems.
In other words, one can use iBus to swap between, say, a German layout and an English layout.9 Since Iād already integrated umlauts and the sharp S into my keyboard layout via xmodmap
, I didnāt need a system to handle more layouts. I thus tried simply quitting iBus from the āQuitā context menu item.
And then compose key sequences started working again! Yay!
Ok, now that I know how to solve the problem, how do I make sure that it doesnāt return?
Stomping on a bug
This wasnāt a bug in the sense that this was an error in code somewhere. It was, however, a behaviour that I didnāt want to have. Thus I could still use the same strategy as when confronted with a bug: after finding the root cause, ensure that the issue never resurfaces.
So whatās the long-term solution in this case? More stumbling through information on the internet showed that
ibus is the default input method (IM) for GNOME desktop. It allows a user to enter characters of a different language. E.g. entering Chinese while your system generally uses a German keyboard layout.
im-config will set up [the] required environment variable and also take care starting of daemon program.
The im-config
program configures the input method,10 of which iBus is one possibility. One configures im-config
via the /etc/default/im-config
file. The first few lines of this file look like the following:
# Default im-config mode (see im-config(8))
# This im-config helps to start best available input method (IM)
# Always start highest priority IM
IM_CONFIG_DEFAULT_MODE=auto
# Start or not to start IM dynamically under CJKV/desktop environment
#IM_CONFIG_DEFAULT_MODE=cjkv
# Never start IM by im-config (Leave it to desktop system)
#IM_CONFIG_DEFAULT_MODE=none
<snip>
Isnāt it wonderful to read such a well-documented configuration file? It makes life so much easier.
Anyway, we can see that, by default, the highest priority input manager (IM
) is started automatically.
# Always start highest priority IM
IM_CONFIG_DEFAULT_MODE=auto
Further down, we can see that if we want to āLeave it to [the] desktop systemā, we should change the IM_CONFIG_DEFAULT_MODE
setting to none
. Since we want to use the desktop system and not an intermediary, we comment out the line
IM_CONFIG_DEFAULT_MODE=auto
so that it reads
# Always start highest priority IM
#IM_CONFIG_DEFAULT_MODE=auto
and activate the line
#IM_CONFIG_DEFAULT_MODE=none
(by removing the comment character) so that it reads like this:
# Never start IM by im-config (Leave it to desktop system)
IM_CONFIG_DEFAULT_MODE=none
Saving the file and restarting X-Windows showed that iBus didnāt start, i.e. its icon doesnāt appear in the taskbar:
Great! Problem solved! And I learned something!
Now I can close all of my browser tabs and finally finish writing that email. š
Compose = e
also works. See https://github.com/kragen/xcompose for a good.XCompose
configuration. ā©And the Euro hadnāt been invented yet! Yes, fellow kids, Iām getting long in the tooth. ā©
Also known as the Multi-Key. ā©
It turns out that the symbol is the ISO composition symbol. I only worked this out much later though, basically because the symbol was so small when displayed on my screen. ā©
My guess is that this is also why my email program wasnāt printing the Euro symbol: something was getting in the way of the compose sequence getting through to the email program. ā©
My windows manager is awesome. No really, I mean it, itās awesome. ā©
I use an English layout on a German keyboard. I tend to confuse people who want to use my computer. ā©
Perhaps my general disdain for ironing clothes had held me back from investigating what this icon was sooner. ā©
The common iBus use case is to allow Japanese, Chinese and Korean (CJK) languages to enter non-ASCII native characters. ā©
Thatās the āimā in
im-config
. ā©