Ubuntu – Dead (compose) keys not working in GTK apps since upgrade

dead keysgtkkubuntuUbuntu

I'm running Kubuntu with KDE as my main desktop environment.

A while ago I set up dead keys so I can type Chinese pinyin and other accented letters and special characters.

As a side note, I use IBUS because it seemed to be easiest to set up my Chinese character IMEs with.

Until the update, dead/compose keys worked fine in all applications.

Now, they work in QT applications, but not GTK ones (such as this browser). This is unfortunate, as it's where I do most of my typing. My workaround right now is to type accents into KDE's launcher and copy past (Alt+F2, type using dead keys, Ctrl+X, Esc, Ctrl+V), which is kind of a hassle.

I'm not sure what information is useful in debugging this, as it's been a while since I set this all up.

Interestingly, the environment variable $QT_IM_MODULE has no value. $GTK_IM_MODULE has xim.

I have ibus-gtk3 installed, I can post whatever information else would be helpful in diagnosing.

I have pasted below the setup script that is in various places (ex. en_US, /etc/X11/xinit/xinput.d/ibus, etc.). I'm not sure which one takes priority, and I'm not sure any are being run, as QT_IM_MODULE has no value when I echo it, whereas these all indicate it should be "xim" by default if not ibus.

I should mention also that the libraries (im-ibus.so, etc) mentioned below I do not have, nor can I find how to get them or where they are to link them. In fact, my gtk-3.0.0/ and qt4/ directories do not even have an inputmethod/ or plugin/ directory. This may be part of the problem, but again, it was working before the update, so I don't know.

# start IBus
# vim: set sts=4 expandtab:

# start IBus daemon
#/usr/bin/ibus-daemon --daemonize --xim
XIM=ibus
XIM_PROGRAM=/usr/bin/ibus-daemon
XIM_ARGS="--xim"

# set variables for the plain XIM
XMODIFIERS=@im=ibus

GTK_IM_MODULE=xim
# use immodule only when available for both GTK 2.0 and 3.0
IM_CONFIG_MARKER2=0
for IM_CONFIG_MARKER in /usr/lib/*/gtk-2.0/*/immodules/im-ibus.so \
                        /usr/lib/gtk-2.0/*/immodules/im-ibus.so ; do
    if [ -e $IM_CONFIG_MARKER ]; then
        IM_CONFIG_MARKER2=1
        break
    fi
done

IM_CONFIG_MARKER3=0
for IM_CONFIG_MARKER in /usr/lib/*/gtk-3.0/*/immodules/im-ibus.so \
                        /usr/lib/gtk-3.0/*/immodules/im-ibus.so ; do
    if [ -e $IM_CONFIG_MARKER ]; then
        IM_CONFIG_MARKER3=1
        break
    fi
done
if [ $IM_CONFIG_MARKER2 = 1 ] && [ $IM_CONFIG_MARKER3 = 1 ] ; then
    GTK_IM_MODULE=ibus
fi

QT_IM_MODULE=xim
# use immodule when available for Qt4 (Qt3 has been long dead)
for IM_CONFIG_MARKER in /usr/lib/*/qt4/plugins/inputmethods/libqtim-ibus.so\
                        /usr/lib/qt4/plugins/inputmethods/libqtim-ibus.so ; do
    if [ -e $IM_CONFIG_MARKER ]; then
        QT_IM_MODULE=ibus
        break
    fi
done

CLUTTER_IM_MODULE=xim
# use immodule when available for clutter
for IM_CONFIG_MARKER in /usr/lib/*/clutter-imcontext/immodules/im-ibus.so \
                        /usr/lib/clutter-imcontext/immodules/im-ibus.so; do
    if [ -e $IM_CONFIG_MARKER ]; then
        CLUTTER_IM_MODULE=ibus
        break
    fi
done

DEPENDS="ibus, ibus-gtk|ibus-qt4|ibus-clutter"

Best Answer

If you use an input module at the X11 level (eg, one defined by XMODIFIERS=…), then X11 doesn't handle dead keys nor compose anymore, it is up to the input module to do it.

What you would need would be a way to switch between XMODIFIERS="@im=ibus" and XMODIFIERS="@im=none" (to let X11 do the work). Maybe there is already a Gtk configuration to do that and have it appear on the right-click menu of input methods; if not, it would be a nice suggestion to Gtk/Gnome team :)

Related Question