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
. â©
Top comments (0)