How to get both custom compose sequences and Unicode character entry

input-methodkeyboard shortcutskeyboard-layoutxorg

Entering raw Unicode characters by first hitting Ctrl+Shift+u and then entering the hex value of a code point to get that character (e.g. 262D for ☭) is quite useful, esp. when you're testing typesetting in assorted languages you can't type and need to pull something out of a language's table.

On the other hand so is setting up custom compose sequences that make sense so you don't have to remember the hex value for frequently used characters. For example I have this in my ~/.Xcompose file:

include "%L"
<Multi_key> <t> <l> : "₺" U20BA

This makes it really easy to get the Turkish Lira sign.

The trouble is that this method of setting up compose sequences only seems to work with the XIM input module (from my ~/.xprofile):

export GTK_IM_MODULE=xim
export QT_IM_MODULE=xim

Of course XIM doesn't support the Unicode entry system above. So it seems to be either or: I can have one or the other if I settle on the useful one before I login to my X session, but once chosen I can't change it.

How can I get the best of both worlds? In there an input module that handles both?

Best Answer

Uim

First released in 2005, uim is a multilingual input method library with interfaces to GTK and QT, as well as anything that supports xim (and more). Looking at computers I have nearby, Arch Linux, NetBSD, and Ubuntu all offer uim packages through their default distribution channels, which (to me) indicates some measure of acceptance in the community at large.

An excerpt from my .xprofile shows how to set this up:

export GTK_IM_MODULE='uim'
export QT_IM_MODULE='uim'
uim-xim &
export XMODIFIERS='@im=uim'
# Start one of the input method switchers
uim-toolbar-gtk-systray &