Input methods in GTK4 apps on Wayland

2026-06-22 #gtk #input-method #wayland

When trying to type using an input method on GTK4 it simply doesn’t work. The same input methods work on GTK3, Qt5, Qt6, and a variety of other applications which don’t use any of these toolkits. GTK4 is the sole outlier.

Running with WAYLAND_DEBUG=1 reveals that GTK4 applications don’t even try to bind to the zwp_text_input_manager_v3 global. A peek through GTK4’s code indicates that the default input method backend is simple, which is really a pseudo-backend which means “don’t use any input method”.

I try explicitly exporting GTK_IM_MODULE=wayland into some GTK4 application, and input method worked normally. Input methods are disabled by default unless we export an environment variable.

Surely somebody who installed and configured and input method and is now running it wouldn’t want to type using it on GTK4 applications, why would they!? They can already type everywhere else!

While skimming a bit more through the codebase, I have an impression that using gsettings set org.gnome.desktop.interface gtk-im-module wayland should work too. But it doesn’t. If I understand all this correct, I need to set some additional dedicated portals and configure them properly in order to tell GTK4 “don’t ignore my input method, I’m actually running it because I want to type with it”.

So another hack goes into ~/.zprofile to sit there forever:

export GTK_IM_MODULE=wayland

Have comments or want to discuss this topic?
Send an email to my public inbox: ~whynothugo/public-inbox@lists.sr.ht.
Reply privately by email: hugo@whynothugo.nl.

— § —