(note: this post was updated in june 2018 to reflect it works with Ubuntu 18.04 and Gnome 3.28.1. Original title "Using .XCompose with Chrome and Sublime Text")
If you use US International keyboard on Linux (e.g., if you write in Spanish or Brazilian Portuguese), you know the royal pain of having to press space after the compose character (typically
'). Contractions like can't, won't, Mary's, etc are a struggle, as you have to press
', otherwise you'll get canť, wonť, Maryś, etc.
It's even more painful if you ever used Windows, as the US Intl Keyboard works fine out of the box. It's a shame that Linux keyboard is still horribly broken by default (some may say it's by design; no, it's not).
It has been asked before, but most answers will point you to use xim, which will open another can of worms. You'll end up in a rabbit hole of Chrome bugs and intrincate workarounds to make Sublime work (spoiler: it won't). Before you realize, the night is gone.
After spending a lot of time troubleshooting, I got to a deceptively simple arrangement, allowing .XCompose customizations on GTK+, QT, Aura (Chromium), and even on plain terminal:
Get rid of the default iBus, xim and everything else, and just go with uim.
Of course, YMMV. I'm running Ubuntu 14.04 with Gnome 3.12.1, and using Chrome v38.0.2125.66 beta, and Sublime Text 3 build 3064.
This also has the added benefit of allowing Unicode characters using
Note that Sublime overrides the default keybinding for
Ctrl+Shift+U with soft_redo (source ). You have two options here: 1) edit the default keybinding file - which is not recommended, as it'll be overwritten on your next upgrade, or 2) use
Ctrl+Shift+Alt+U. I've chosen the latter.
- Install uim with
sudo apt-get install uim
- Check which inputs you have installed with
im-config -l. Keep only uim and xim (optional, but recommended); remove the rest with
apt remove ibus etc
im-config -n uimto set the default input to uim
- On System Config, Regional Settings, select "US, intl with dead keys"
- On System Config, Language Support, confirm you have uim under Keyboard input method system. If you removed the other input systems, you should have only uim/none here
Add the following lines to /etc/environment:
GTK_IM_MODULE=uim QT_IM_MODULE=uim xmodmap -e 'keycode 48 = dead_acute dead_diaeresis dead_acute dead_diaeresis acute diaeresis'
- Download this
.XComposefile and put on your home directory, using
wget http://bit.ly/XCompose2 ~
- Log out, log back in and enjoy!
Don't forget to say thanks to @tamh, who did all the hard work to map the correct keys on the .XCompose.