16

Since UIM didn't want to play ball after installing Ubuntu 12.04 from scratch, I tried IBus, since that's the IME framework that's coming with Ubuntu by default.

However, ibus-table-compose is a pain in the butt to use because just to enter one character I need to press the key combination to trigger IBus first, enter the respective compose sequence, then press the IBus key combination again to disable it. Instead of that I'd rather like to keep my compose key functionality as provided by XIM, since that requires fewer keystrokes.

The problem is, though, that when the default input method is set to IBus and IBus is deactivated so that (AIUI, since I started it with ibus-daemon --xim) it is bypassed in favor of XIM, the settings in ~/.XCompose seem to be overridden by IBus's own version, so e.g. Compose c a doesn't give ą (a-ogonek) as I defined in the .XCompose file in my home directory, but ǎ (a-hacek), as defined by some other settings.

I've grown quite accustomed to my own mnemnonics, so is there any way to make my system use my own ~/.XCompose file with the default input method still being set to IBus so that IBus will still work e.g. in OpenOffice and other applications that don't let you choose the input method with a context menu?

Note: This is not a duplicate of the question How can I get compose back on ibus?

1
  • This question appears to be abandoned and unanswered. If you solved it, please post an answer explaining how it was solved (answering your own questions is not merely permitted, but encouraged when there is no other answer that does the job). If the question no longer applies you may voluntarily delete/close it. Jun 14, 2013 at 0:15

4 Answers 4

6

Update

ibus works now with .XCompose file: https://github.com/ibus/ibus/issues/1876

Previous Answer (still works)

As stated by @von, you could not use .XCompose with IBUS for some years.

In the case your distro is still old, you can use uim as Input Method, which supports Unicode, both GTK+ and Qt immodules with legacy XIM support.

A good way to handle your .XCompose and keep existing global Compose is:

  1. Install uim:

    sudo apt-get install uim

  2. Make it the default Input Method:

    im-config -n uim

  3. Edit your .XCompose and add the current keyboard locale (in my case, en_US) as first line:

    include "/usr/share/X11/locale/en_US.UTF-8/Compose"

  4. Done! Restart the programs you want to start to get your .XCompose file.

Known Issues

Ubuntu Unity Dash will never produces a cedilla.

Other Distros

I played a bit with .XCompose and Input Methods on modern distros these days, while trying make Linux keep the same keyboard behavior as Windows(TM) for latin languages (output ç instead of ć, no accented consonants, etc).

I created a repo with this instructions (for Ubuntu and other distributions too): https://github.com/raelgc/win_us_intl

7
  • 4
    What exactly "you CANNOT use your .XCompose with IBUS for now" means? What have changed? Was this change in the Ubuntu itself or in something that Ubuntu uses?
    – andrybak
    Mar 14, 2015 at 19:15
  • @AndreyRybak IBUS is newest then XIM and uim and doesn't support .XCompose files yet (and I'm not sure if that will change, as one year later still the same status). No, it's not Ubuntu specific. Mar 15, 2015 at 15:05
  • It seems to be working for me in 16.04 (with Gnome). May 18, 2018 at 16:14
  • @DennisWilliamson You mean, IBUS and .XCompose? Just crossing my fingers that this get fixed 4 years since my above answer. May 18, 2018 at 20:12
  • 2
    Yes. I had a small ~/.Xcompose with working entries. I added a bunch of new entries, they didn't function, then I did ibus restart and all the new ones worked. May 18, 2018 at 20:37
3

Since Dennis Williamson said it worked in 16.04 in a comment above, I tested in this fresh 18.04 install with a short .XCompose copied from my previous 16.04 install.

# Import default rules from the system Compose file
include "%L"

# Custom definitions
<Multi_key> <R> <R> <R>             : "ʁ"   U0281 # LATIN LETTER SMALL CAPITAL INVERTED R

Then I ran ibus restart in a terminal and I can type ʁ.

1

The problem is, though, that when the default input method is set to IBus and IBus is deactivated so that (AIUI, since I started it with ibus-daemon --xim) it is bypassed in favor of XIM, the settings in ~/.XCompose seem to be overridden by IBus's own version, so e.g. Compose c a doesn't give ą (a-ogonek) as I defined in the .XCompose file in my home directory, but ǎ (a-hacek), as defined by some other settings.

It appears that it is not defined by some other settings, in the sense of some configuration file you might edit. It appears that it is compiled in, hard-coded in the file gtkimcontextsimpleseqs.h. It further appears that it's not easy to customize the gtk_compose_seqs_compact array in that file and add your own Compose key sequences. The table is optimized for space, not easy editiability. So the "simply change the source and recompile" strategy may be more difficult than I thought.

I've grown quite accustomed to my own mnemnonics, so is there any way to make my system use my own ~/.XCompose file with the default input method still being set to IBus so that IBus will still work e.g. in OpenOffice and other applications that don't let you choose the input method with a context menu?

There is a bug report at https://bugzilla.gnome.org/show_bug.cgi?id=155010 which has a patch that (they say) would make it possible to customize the compose table. It still wouldn't use your ~/.XCompose file, and the syntax would be different, but it's something. But I note that the bug in question is still open, so I guess this has not made it into the official releases yet.

0
  1. Set globally (i.e. for Ubuntu in /etc/environment) the QT_IM_MODULE, GTK_IM_MODULE variables (the last unneeded for gnome) to ibus, and XMODIFIERS to @im=ibus.

  2.α Execute setxkbmap with -option to choose compose key. E.g. to use the right logo key: setxkbmap -option compose:rwin. This would be overwritten on reboot.

  2.β To retain the setting on reboot, create the /etc/X11/xorg.conf.d/00-keyboard.conf with the following content:

Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbOptions"    "compose:rwin"
EndSection

Tested, and works for both X11 and (at least the setxkbmap way) Wayland.

Thanks for a hint goes to fujiwarat, updated per this discussion.

4
  • 1
    Changing system-wide config is crazy though. Just put 2alpha and those environment variables in your .xprofile or .xinitrc whichever one it is you're using. Mar 3, 2017 at 14:08
  • @enigmaticPhysicist err… lol, what?? Make me unsee it — you first made pared down version of my answer, then downvoted mine one for addition which your answer doesn't have (how are you going to retain the config on reboot dude?), and which is optional (as you can see by enumeration and the explanation).
    – Hi-Angel
    Mar 3, 2017 at 16:51
  • Someone can't take criticism... Hey do you have orange hair, by any chance? Mar 3, 2017 at 21:06
  • @enigmaticPhysicist lol you didn't do a critique. You copied my answer, then downvoted mine to be on top. It could've even worked if you didn't leave the comment, so I noticed, and flagged your answer. As for the content of your comment — I already replied. And sorry, I didn't get — what is the orange-hairs joke about?
    – Hi-Angel
    Mar 4, 2017 at 5:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .