Disable transient symbols for compose and dead keys in GTK programs
An article in the GTK blog explains the situation very well, but here is my go at it.
In my keyboard layout, accents are handled as dead keys, so to insert "ë", first I type ¨
and then e
. Nothing happens on the screen until the very last step, at which point ë
is inserted.
That, however, recently changed in all my GTK3 programs: An underlined meta-character is displayed when a dead key is pressed. E.g., when I type ¨
, I see an underlined diaeresis:
Of course, that transient character goes away once I complete the sequence by pressing e
, but I find the new behavior confusing because for years I have been used not to see any character until after the key sequence was complete. Now it just looks like I have fat-fingered — not to mention some misbehavior that may occur in some programs when backspacing.
The same happens when using a compose sequences.
Thus the question: How can I disable transient symbols for compose and dead keys and revert back to the good, old behavior?
1 answer
This is related to GTK having its own input method, which overrules the native X Window System method and even other third-party methods, such as Ibus and Fcitx.
An user with basic needs (for instance, one who only inputs ASCII) wouldn't notice the differences between them. One such difference is Ctrl+Shift+U
allowing for hex Unicode input in GTK. Another is the one mentioned in the question.
Fortunately, you can tell GTK which input method to use with the GTK_IM_MODULE
environment variable. The available modules can be listed with
gtk-query-immodules-3.0
One who doesn't do fancy things beyond dead keys or compose, which the native X Input Method supports, can simply choose xim
from that list.
To verify if it works, launch the GTK application (here, Firefox) with
GTK_IM_MODULE=xim firefox
Once satisfied with the selected input method, put that variable in a initialization file so that you don't have to type it by hand every time. The right file depends on your system; Since I always start my session at a login shell, I find .profile
ideal, but others to consider are .xinitrc
and .xsession
. Note that .bashrc
may not be good enough if you log-in via a display manager and want to keep using launchers to start your programs.
Conclusion
Add this line to ~/.profile
and reboot.
export GTK_IM_MODULE=xim
Additional references
- Fcitx: Input method related environment variables.
- Unix & Linux: Dead (compose) keys not working in GTK apps since upgrade.
- Unix & Linux: Understanding and setting up different input methods.
- Wikipedia: List of input methods for Unix platforms.
0 comment threads