I want to use IBus with libpinyin on my NixOS install with KDE plasma. IBus is installed and works fine, with the following config in /etc/nixos/configuration.nix

# use IBus for input
i18n.inputMethod = {
    enabled = "ibus";
    ibus.engines = with pkgs.ibus-engines; [libpinyin];

I also want to be able to compose some specific characters when I am using libpinyin in 'English' mode or when I am using the English input engine. Following various guides I tried the following configuration:


xmodmap -e "keysym ISO_Level3_Shift = Multi_key"


include "%L"
# Compose keys for pinyin with tone marks
<Multi_key> <a> <a> : "ā" 
<Multi_key> <a> <e> : "ē" 
<Multi_key> <a> <i> : "ī" 
<Multi_key> <a> <o> : "ō" 
<Multi_key> <a> <u> : "ū" 
<Multi_key> <s> <a> : "á" 
<Multi_key> <s> <e> : "é" 
<Multi_key> <s> <i> : "í" 
<Multi_key> <s> <o> : "ó" 
<Multi_key> <s> <u> : "ú" 
<Multi_key> <d> <a> : "ǎ" 
<Multi_key> <d> <e> : "ě" 
<Multi_key> <d> <i> : "ǐ" 
<Multi_key> <d> <o> : "ǒ" 
<Multi_key> <d> <u> : "ǔ" 
<Multi_key> <f> <a> : "à" 
<Multi_key> <f> <e> : "è" 
<Multi_key> <f> <i> : "ì" 
<Multi_key> <f> <o> : "ò" 
<Multi_key> <f> <u> : "ù" 

With this configuration, no compose characters work. If I run bash ~/.xsessionrc then I can see that xev reports the correct compose characters like so;

If I type <alt_gr> <s> <a>, then various events appear in the log, one of which includes this line:

XmbLookupString gives 3 bytes: (61 cc 81) "á"

So the xsessionrc file isn't running at the right time (on login I suppose), but furthermore, no other applications actually allow me to use the compose combinations. Both kwrite and chromium ignore the XCompose config, even after using the suggested config below in my ~/.profile;

export GTK_IM_MODULE=ibus
export XMODIFIERS=@im=ibus
export QT_IM_MODULE=ibus

(This config is getting set, as env shows these variables as being set.)

To be clear it is only xev that shows that the config might be somewhat correct. No real application that actually needs input will let me compose these characters. How can I get the compose behaviour I want?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.