There are several possibilities for Gtk+ input method modules.
The im module decides how additional input aside direct key translation is handled in Gtk+.
So the available compose key sequences depend on what im module you are using. (The symbolic X11 name for the compose key is Multi_key
btw.)
The gtk-query-immodules-3.0
command can be used to show the installed modules and it can also be used to upate the cache (with sudo gtk-query-immodules-3.0 --update-cache
).
Sample output:
# GTK+ Input Method Modules file
# Automatically generated file, do not edit
# Created by gtk-query-immodules-3.0 from gtk+-3.24.1
#
# ModulesPath = /usr/lib64/gtk-3.0/3.0.0/x86_64-pc-linux-gnu/immodules:/usr/lib64/gtk-3.0/3.0.0/immodules:/usr/lib64/gtk-3.0/x86_64-pc-linux-gnu/immodules:/usr/lib64/gtk-3.0/immodules
#
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-am-et.so"
"am_et" "Amharic (EZ+)" "gtk30" "/usr/share/locale" "am"
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-cedilla.so"
"cedilla" "Cedilla" "gtk30" "/usr/share/locale" "az:ca:co:fr:gv:oc:pt:sq:tr:wa"
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-cyrillic-translit.so"
"cyrillic_translit" "Cyrillic (Transliterated)" "gtk30" "/usr/share/locale" ""
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-ibus.so"
"ibus" "IBus (Intelligent Input Bus)" "ibus" "" "ja:ko:zh:*"
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-inuktitut.so"
"inuktitut" "Inuktitut (Transliterated)" "gtk30" "/usr/share/locale" "iu"
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-ipa.so"
"ipa" "IPA" "gtk30" "/usr/share/locale" ""
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-multipress.so"
"multipress" "Multipress" "gtk30" "" ""
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-thai.so"
"thai" "Thai-Lao" "gtk30" "/usr/share/locale" "lo:th"
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-ti-er.so"
"ti_er" "Tigrigna-Eritrean (EZ+)" "gtk30" "/usr/share/locale" "ti"
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-ti-et.so"
"ti_et" "Tigrigna-Ethiopian (EZ+)" "gtk30" "/usr/share/locale" "ti"
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-viqr.so"
"viqr" "Vietnamese (VIQR)" "gtk30" "/usr/share/locale" "vi"
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-wayland.so"
"wayland" "Wayland" "gtk30" "/usr/share/locale" ""
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-waylandgtk.so"
"waylandgtk" "Waylandgtk" "gtk30" "/usr/share/locale" ""
"/usr/lib64/gtk-3.0/3.0.0/immodules/im-xim.so"
"xim" "X Input Method" "gtk30" "/usr/share/locale" "ko:ja:th:zh"
xim is the traditional X11 Input Method.
ibus is a more modern input method.
There are several input methods that are used for languages which use non-latin scripts / alphabets.
There are two built-in modules that are not listed by the tool, which are:
- gtk-im-context-none (which disables all advanced input)
- gtk-im-context-simple (which is described well in xiotas answer)
It is possible to write your own module if you have the necessary programming skills, see the API documentation here:
https://developer.gnome.org/gtk3/stable/GtkIMContext.html#GtkIMContext.description
I found a useful test tool to easily try out input methods:
https://github.com/ibus/ibus/files/1829333/window.py.txt
from gi import require_version as gi_require_version
gi_require_version('Gtk', '3.0')
gi_require_version('Gdk', '3.0')
from gi.repository import Gtk
from gi.repository import Gdk
import sys
label = None
def __entry_key_press_cb(entry, event):
label.set_text('%s %x %x' % (Gdk.keyval_name(event.keyval), event.hardware_keycode, event.state))
Gtk.init(sys.argv)
window = Gtk.Window(type = Gtk.WindowType.TOPLEVEL)
window.connect('destroy', Gtk.main_quit)
box = Gtk.Box(orientation = Gtk.Orientation.VERTICAL, spacing = 0)
window.add(box)
entry = Gtk.Entry()
entry.connect('key-press-event', __entry_key_press_cb)
#box.pack_start(entry, False, False, 0)
box.add(entry)
label = Gtk.Label(label = 'Press keys')
#box.pack_start(label, False, False, 0)
box.add(label)
window.show_all()
Gtk.main()
You can run it like this:
env GTK_IM_MODULE=gtk-im-context-simple python window.py
or
env GTK_IM_MODULE=xim python window.py
etc.
/etc/default/keyboard
or something else?) – xiota May 18 '18 at 12:03/etc/default/keyboard
. Don't know if it makes a difference. You can also try putting theinclude
at the end of the config to see if it makes a difference. Otherwise, it looks like multi-character output and sequences longer than 5 won't work. – xiota May 20 '18 at 16:11