You are not logged in.

#1 2021-08-24 04:59:06

Salkay
Member
Registered: 2014-05-22
Posts: 683

[SOLVED] Compose key fails for GTK2 apps

My compose key works fine in Qt and GTK3 apps (e.g. Firefox), but fails in GTK2 apps (e.g. Pidgin and GIMP). I've tried creating ~/.xprofile with

export GTK_IM_MODULE=xim
export XMODIFIERS="@im=none"

then restarting, but this does not help. Oddly enough, this doesn't seem necessary for GTK3 apps.

I'm not sure if relevant, but I checked /usr/lib/gtk-2.0/2.10.0/immodules.cache, and I can see the following present

"/usr/lib/gtk-2.0/2.10.0/immodules/im-xim.so" 
"xim" "X Input Method" "gtk20" "/usr/share/locale" "ko:ja:th:zh" 

This .so file also exists. How can I get my compose key working for GTK2 apps?

Last edited by Salkay (2021-08-24 07:26:07)

Offline

#2 2021-08-24 06:11:52

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,491

Re: [SOLVED] Compose key fails for GTK2 apps

GTK_IM_MODULE="xim" gtk-demo

worksforme™
Check

tr '\0' '\n' < /proc/$(pidof some_gtk_process)/environ

to see whether your exports are actually being picked up (or eg. overwritten)

Offline

#3 2021-08-24 06:37:16

Salkay
Member
Registered: 2014-05-22
Posts: 683

Re: [SOLVED] Compose key fails for GTK2 apps

Thanks @seth! You were exactly correct. My exports weren't being picked up. When I manually specified GTK_IM_MODULE in the CLI, it worked fine.

I realised that ~/.xprofile wasn't being sourced because I'm using startx, not a display manager. As per the wiki, I tried modifying ~/.xinitrc

[ -f ~/.xprofile ] && . ~/.xprofile
exec startplasma-x11

But this just gave me a black screen with a mouse cursor.

I tried adding '&' after the first line, which let me start X, but xprofile was still not sourced. Finally, I just put export GTK_IM_MODULE=xim directly into ~/.xinitrc, and that worked. I have no idea what I couldn't source the external file though, nor why it would block the second line.

Offline

#4 2021-08-24 06:38:57

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,491

Re: [SOLVED] Compose key fails for GTK2 apps

cat ~/.xprofile

Offline

#5 2021-08-24 06:42:09

Salkay
Member
Registered: 2014-05-22
Posts: 683

Re: [SOLVED] Compose key fails for GTK2 apps

$ cat ~/.xprofile
# to allow compose to work in gtk applications
export GTK_IM_MODULE=xim
export XMODIFIERS="@im=none"

EDIT: hang on, let me do more troubleshooting

Last edited by Salkay (2021-08-24 06:44:19)

Offline

#6 2021-08-24 07:25:55

Salkay
Member
Registered: 2014-05-22
Posts: 683

Re: [SOLVED] Compose key fails for GTK2 apps

Thanks again @seth.

I'm not sure what the problem was, but it's all fine now. I reverted ~/.xprofile and ~/.xinit, and they seem to work fine. Maybe the error earlier was just Plasma being coincidentally buggy when I tested that one time.

To summarise, the following works fine:

$ cat ~/.xinitrc
#!/bin/sh

[ -f /etc/xprofile ] && . /etc/xprofile
[ -f ~/.xprofile ] && . ~/.xprofile

exec startplasma-x11
$ cat ~/.xprofile
# to allow compose to work in gtk applications
export GTK_IM_MODULE=xim
export XMODIFIERS="@im=none"

Offline

Board footer

Powered by FluxBB