[dev] [st] XIM switching problems in combination with XKB dead keys

From: Maarten van Gompel <proycon_AT_anaproy.nl>
Date: Fri, 17 Jul 2020 19:01:59 +0200


I identified a problem when switching input methods: XIM and XKB keymaps
with dead keys can not be used properly in the same session as that
breaks the dead keys (= composition keys for diacritics).

My situation: I use regular XKB to type in languages using a latin or
cyrillic script, but for Chinese I need of course need a proper input
method (e.g. fcitx or ibus-libpinyin). I want to change between input
methods on the fly, this currently does not work, if st is started with
a XMODIFIERS="_AT_im=whatever" then normal dead keys don't work, regardless
whether the underlying XIM server is running or not, if it is started
with an empty XMODIFIERS="", then they do work. It means I need to
restart the terminal if I want to properly switch between chinese and my
usual dead keys. Switching in my case entails killing the XIM server if
it's running and running setxkbmap to set the desired keymap.

To reproduce:

Case 1)
 $ export XMODIFIERS=""
 $ setxbkmap es
 $ st
Type apostrophe a and output is á , as expected, but of course no XIM now

Case 2)
 $ export XMODIFIERS="_AT_im=fcitx"
 $ setxbkmap es #spanish XKB keymap to illustrate the issue
 $ st
Type apostrophe a and output is 'a instead of á

I think st should behave the same way most applications do; if the xim
server is not running, it should exhibit the same behaviour as if no XIM
was configured at all. (for comparison; terminals like urxvt and
alacritty behave in this way, GTK and QT apps too)

The problem was introduced in the following commit:

    787c9a55fea7131b4f1e5c7699b68b3517db8e49 Quentin Rameau x: fix XIM handling

Prior to this commit though, the situation was much worse as st would
simply crash if the XIM server stopped, so there's good progress but we
aren't entirely there yet :)


Maarten van Gompel
GnuPG key:  0x39FE11201A31555C
XMPP:       proycon_AT_anaproy.nl       Matrix: @proycon:matrix.anaproy.nl
Telegram:   proycon                  IRC: proycon (freenode)
Mastodon:   https://social.anaproy.nl/_AT_proycon   (_AT_proycon_AT_social.anaproy.nl)
Twitter:    https://twitter.com/proycon
Received on Fri Jul 17 2020 - 19:01:59 CEST

This archive was generated by hypermail 2.3.0 : Fri Jul 17 2020 - 19:12:07 CEST