Using fcitx5 in Guix

I am running guix with xfce on my laptop. I would like to install fcitx5 so that I can input Chinese using pinyin.

I have installed fcitxt5 and gotten as far as getting it to work inside of emacs, but I can’t get it to work inside of FireFox or LibreOffice. I’m stuck, out of ideas, and hoping someone can lend a hand and point me in the right direction.

In my home.scm file, I have installed the following packages:

(packages (append (list ... fcitx5 fcitx5-chinese-addons fcitx5-configtool fcitx5-gtk fcitx5-gtk4 fcitx5-qt ...

In my home.scm file, I have declare the following paths:

(services (append (list
      (simple-service 'fcitx5-env-vars
        home-environment-variables-service-type
          '(("XMODIFIERS" . "@im=fcitx")
            ("GTK_IM_MODULE" . "fcitx")
            ("QT_IM_MODULE" . "fcitx")
            ("SDL_IM_MODULE" . "fcitx")

            ("LANG" . "en_US.UTF-8")
            ("LC_CTYPE" . "en_US.UTF-8")

            ("GUIX_LOCPATH" . "${HOME}/.guix-home/profile/lib/locale")
      
            ("GTK_PATH" . "${HOME}/.guix-home/profile/lib/gtk-2.0:${HOME}/.guix-home/profile/lib/gtk-3.0:${HOME}/.guix-home/profile/lib/gtk-4.0")

            ("GTK_IM_MODULE_FILE" . "${HOME}/.guix-home/profile/lib/gtk-2.0/2.10.0/immodules-gtk2.cache:${HOME}/.guix-home/profile/lib/gtk-3.0/3.0.0/immodules-gtk3.cache:${HOME}/.guix-home/profile/lib/gtk-4.0/4.0.0/immodules")

            ("QT_PLUGIN_PATH" . "${HOME}/.guix-home/profile/lib/qt5/plugins")
                      
            ("QT6_PLUGIN_PATH" . "${HOME}/.guix-home/profile/lib/qt6/plugins/platforminputcontexts")))

And this is the output of my fcitxt5-diagnose

# System Info:
1.  `uname -a`:

        Linux **** 7.0.14 #1 SMP PREEMPT_DYNAMIC 1 x86_64 GNU/Linux

2.  `lsb_release`:

    `lsb_release` not found.

3.  `/etc/lsb-release`:

    `/etc/lsb-release` not found.

4.  `/etc/os-release`:

        NAME="Guix System"
        ID=guix
        PRETTY_NAME="Guix System"
        LOGO=guix-icon
        HOME_URL="https://guix.gnu.org"
        DOCUMENTATION_URL="https://guix.gnu.org/en/manual"
        SUPPORT_URL="https://guix.gnu.org/en/help"
        BUG_REPORT_URL="https://codeberg.org/guix/guix/issues"

5.  Desktop Environment:

    Desktop environment is `xfce`.

6.  XDG SESSION TYPE:

        XDG_SESSION_TYPE='x11'

7.  Bash Version:

        BASH_VERSION='5.2.37(1)-release'

# Environment:
1.  DISPLAY:

        DISPLAY=':0.0'


        WAYLAND_DISPLAY=''

2.  Keyboard Layout:

    1.  `setxkbmap`:

        `setxkbmap` not found.

    2.  `xprop`:

        `xprop` not found.

3.  Locale:

    1.  All locales:

            ar_DZ.utf8
            C
            en_GB.utf8
            en_US.utf8
            es_AR.utf8
            es_ES.utf8
            fr_FR.utf8
            POSIX
            pt_BR.utf8
            pt_PT.utf8
            ru_RU.utf8
            zh_CN.utf8

    2.  Current locale:

            LANG=en_US.UTF-8
            LC_CTYPE=en_US.UTF-8
            LC_NUMERIC="en_US.UTF-8"
            LC_TIME="en_US.UTF-8"
            LC_COLLATE="en_US.UTF-8"
            LC_MONETARY="en_US.UTF-8"
            LC_MESSAGES="en_US.UTF-8"
            LC_PAPER="en_US.UTF-8"
            LC_NAME="en_US.UTF-8"
            LC_ADDRESS="en_US.UTF-8"
            LC_TELEPHONE="en_US.UTF-8"
            LC_MEASUREMENT="en_US.UTF-8"
            LC_IDENTIFICATION="en_US.UTF-8"
            LC_ALL=

4.  Directories:

    1.  Home:

            /home/***

    2.  `${XDG_CONFIG_HOME}`:

        Environment variable `XDG_CONFIG_HOME` is set to `/home/***/.config`.

        Current value of `XDG_CONFIG_HOME` is `~/.config` (`/home/***/.config`).

    3.  Fcitx5 Settings Directory:

        Current fcitx5 settings directory is `~/.config/fcitx5` (`/home/***/.config/fcitx5`).

5.  Current user:

    The script is run as *** (1000).

# Fcitx State:
1.  executable:

    Found fcitx5 at `/home/***/.guix-home/profile/bin/fcitx5`.

2.  version:

    Fcitx version: `5.1.19`

3.  process:

    Found 1 fcitx5 process:

        10767 fcitx5

4.  `fcitx5-remote`:

    `fcitx5-remote` works properly.

5.  DBus interface:

    Using `dbus-send` to check dbus.

    Owner of DBus name `org.fcitx.Fcitx5` is `:1.134`.

    PID of DBus name `org.fcitx.Fcitx5` owner is `10767`.

    Debug information from dbus:

           Group [x11::0.0] has 1 InputContext(s)
          IC [006981037ad448f69ca2ea02dc0d406f] program:.emacs-30.2-real frontend:xim cap:4000000000 focus:0
        Input Context without group

# Frontends setup:
The environment variable checked by this script only shows the environment under current shell. It is still possible that you did not set the environment to the whole graphic desktop session. You may inspect the actual environment variable of a certain process by using `xargs -0 -L1 /proc/$PID/environ` for a certain process that you find not working.

## Xim:
1.  `${XMODIFIERS}`:

    Environment variable XMODIFIERS is set to "@im=fcitx" correctly.
    Xim Server Name from Environment variable is fcitx.

2.  XIM_SERVERS on root window:

    **`xprop` not found.**

3.  XIM for Emacs:

    **Your LC_CTYPE is set to en_US.UTF-8 instead of one of zh, ja, ko. You may not be able to use input method in emacs because of an really old emacs bug that upstream refuse to fix for years.**

## Qt:
1.  qt4 - `${QT4_IM_MODULE}`:

    Environment variable QT_IM_MODULE is set to "fcitx" correctly.

    **`fcitx5-qt4-immodule-probing` not found.**

2.  qt5 - `${QT_IM_MODULE}`:

    Environment variable QT_IM_MODULE is set to "fcitx" correctly.

    Using fcitx5-qt5-immodule-probing to check the actual im module to be used under current environment:

        QT_QPA_PLATFORM=xcb
        QT_IM_MODULE=fcitx
        IM_MODULE_CLASSNAME=fcitx::QFcitxPlatformInputContext

3.  qt6 - `${QT_IM_MODULE}`:

    Environment variable QT_IM_MODULE is set to "fcitx" correctly.

    Using fcitx5-qt6-immodule-probing to check the actual im module to be used under current environment:

        QT_QPA_PLATFORM=xcb
        QT_IM_MODULE=fcitx
        IM_MODULE_CLASSNAME=QComposeInputContext

4.  Qt IM module files:


    Following error may not be accurate because guessing Qt version from path depends on how your distribution packages Qt. It is not a critical error if you do not use any Qt application with certain version of Qt or you are using text-input support by Qt under Wayland.
    **Cannot find fcitx5 input method module for Qt4.**
    **Cannot find fcitx5 input method module for Qt5.**
    **Cannot find fcitx5 input method module for Qt6.**

## Gtk:
1.  gtk - `${GTK_IM_MODULE}`:

    Environment variable GTK_IM_MODULE is set to "fcitx" correctly.

    Using fcitx5-gtk2-immodule-probing to check the actual im module to be used under current environment:

        GTK_IM_MODULE=gtk-im-context-simple

    Using fcitx5-gtk3-immodule-probing to check the actual im module to be used under current environment:

        GTK_IM_MODULE=gtk-im-context-simple

    Using fcitx5-gtk4-immodule-probing to check the actual im module to be used under current environment:

        GTK_IM_MODULE=fcitx

2.  `gtk-query-immodules`:

    1.  gtk 2:

        **Cannot find `gtk-query-immodules` for gtk 2**

        **Cannot find fcitx5 im module for gtk 2.**

    2.  gtk 3:

        **Cannot find `gtk-query-immodules` for gtk 3**

        **Cannot find fcitx5 im module for gtk 3.**

3.  Gtk IM module cache:

    1.  gtk 2:

        Found immodules cache for gtk `2.24.33` at `./.local/share/guix-sandbox-home/.local/share/Steam/steamrt64/pv-runtime/steam-runtime-steamrt/var/tmp-BFQTR3/usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/immodules.cache`.
        Version Line:

            # Created by /usr/lib/i386-linux-gnu/libgtk2.0-0/gtk-query-immodules-2.0 from gtk+-2.24.33

        **Failed to find fcitx5 in immodule cache at `./.local/share/guix-sandbox-home/.local/share/Steam/steamrt64/pv-runtime/steam-runtime-steamrt/var/tmp-BFQTR3/usr/lib/i386-linux-gnu/gtk-2.0/2.10.0/immodules.cache`**

        Found immodules cache for gtk `2.24.33` at `./.local/share/guix-sandbox-home/.local/share/Steam/steamrt64/pv-runtime/steam-runtime-steamrt/var/tmp-BFQTR3/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules.cache`.
        Version Line:

            # Created by /usr/lib/x86_64-linux-gnu/libgtk2.0-0/gtk-query-immodules-2.0 from gtk+-2.24.33

        **Failed to find fcitx5 in immodule cache at `./.local/share/guix-sandbox-home/.local/share/Steam/steamrt64/pv-runtime/steam-runtime-steamrt/var/tmp-BFQTR3/usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules.cache`**

        **Cannot find fcitx5 im module for gtk 2 in cache.**

    2.  gtk 3:

        Found immodules cache for gtk `3.24.24` at `./.local/share/guix-sandbox-home/.local/share/Steam/steamrt64/pv-runtime/steam-runtime-steamrt/var/tmp-BFQTR3/usr/lib/i386-linux-gnu/gtk-3.0/3.0.0/immodules.cache`.
        Version Line:

            # Created by /usr/lib/i386-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0 from gtk+-3.24.24

        **Failed to find fcitx5 in immodule cache at `./.local/share/guix-sandbox-home/.local/share/Steam/steamrt64/pv-runtime/steam-runtime-steamrt/var/tmp-BFQTR3/usr/lib/i386-linux-gnu/gtk-3.0/3.0.0/immodules.cache`**

        Found immodules cache for gtk `3.24.24` at `./.local/share/guix-sandbox-home/.local/share/Steam/steamrt64/pv-runtime/steam-runtime-steamrt/var/tmp-BFQTR3/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules.cache`.
        Version Line:

            # Created by /usr/lib/x86_64-linux-gnu/libgtk-3-0/gtk-query-immodules-3.0 from gtk+-3.24.24

        **Failed to find fcitx5 in immodule cache at `./.local/share/guix-sandbox-home/.local/share/Steam/steamrt64/pv-runtime/steam-runtime-steamrt/var/tmp-BFQTR3/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules.cache`**

        **Cannot find fcitx5 im module for gtk 3 in cache.**

4.  Gtk IM module files:

    1.  gtk 2:

        All found Gtk 2 immodule files exist.

    2.  gtk 3:

        All found Gtk 3 immodule files exist.

    3.  gtk 4:

        All found Gtk 4 immodule files exist.

# Configuration:
## Fcitx Addons:
1.  Addon Config Dir:

    Found fcitx5 addon config directory: `/gnu/store/vmd7s4f0alrb2c9fzjhll0xf73lklamn-fcitx5-5.1.19/share/fcitx5/addon`.

2.  Addon List:

    1.  Found 20 enabled addons:

            Classic User Interface 5.1.19
            Clipboard 5.1.19
            DBus 5.1.19
            DBus Frontend 5.1.19
            Emoji 5.1.19
            Fcitx4 Frontend 5.1.19
            IBus Frontend 5.1.19
            Input method selector 5.1.19
            Keyboard 5.1.19
            KDE Input Method Panel 5.1.19
            Status Notifier 5.1.19
            Notification 5.1.19
            Quick Phrase 5.1.19
            Spell 5.1.19
            Unicode 5.1.19
            DBus Virtual Keyboard 5.1.19
            Wayland 5.1.19
            Wayland Input method frontend 5.1.19
            XCB 5.1.19
            X Input Method Frontend 5.1.19

    2.  Found 0 disabled addons:

3.  Addon Libraries:

    All libraries for all addons are found.

4.  User Interface:

    Found 3 enabled user interface addons:

        Classic User Interface
        KDE Input Method Panel
        DBus Virtual Keyboard

## Input Methods:
1.  `/home/howardpan/.config/fcitx5/profile`:

        [Groups/0]
        # Group Name
        Name=Default
        # Layout
        Default Layout=us
        # Default Input Method
        DefaultIM=keyboard-us

        [Groups/0/Items/0]
        # Name
        Name=pinyin
        # Layout
        Layout=

        [Groups/0/Items/1]
        # Name
        Name=keyboard-us
        # Layout
        Layout=

        [GroupOrder]
        0=Default

# Log:
1.  `date`:

        Wed Jul  8 05:11:18 PM CST 2026

2.  `/home/***/.config/fcitx5/crash.log`:

    `/home/***/.config/fcitx5/crash.log` not found.

**Warning: the output of fcitx5-diagnose contains sensitive information, including the distribution name, kernel version, name of currently running programs, etc.**

**Though such information can be helpful to developers for diagnostic purpose, please double check and remove as necessary before posting it online publicly.**

Great post! I would love to be able to write Japanese and Chinese myself one day, so I’m eyeing on fcitx5 myself and I use XFCE as well, but I’m working on different projects right now.

I have just one question: Firefox? Where did you get firefox from? Icecat is the default of guix and librewolf the first alternative as far as I can tell.

Firefly is part of nonguix.

Since you asked on multiple places, I’m pasting the reply here as well.

A few outputs might be missing for fcitx5-gtk. Add them into your package list as well.

`(,fcitx5-gtk "gtk2")
`(,fcitx5-gtk "gtk3")

It seems that you want to use it in Steam? Then please launch Steam with environment variable LANG=zh_CN.UTF-8, otherwise fcitx5 won’t work.

See also: my fcitx5 home service that should do the minimal work, and QT support issue.

Hi,

Thanks for your tip. This seems to have fixed my problem. By adding the sub-packages “gtk2” and “gtk3” to my packages, I was able to get fcitx5 to work in emacs, firefox and libreoffice now.

One thing I don’t understand is I had to uninstall steam to get it to work. Re-installing steam did not prevent it from working, so I don’t quite understand what went on there. ))

I dont have firefox, but I do have it working in icecat and kitty. The former I mention because it’s similar to firefox and I mention the latter because I had to do some foolish variable settings to make it work in kitty under xorg.

I had a similar packages list…

                    ;; IME
                    fcitx5
                    ; fcitx5-configtool ; sucks in kde garbage but is needed to configure ime for first use, so use a guix shell
                    fcitx5-chinese-addons

Note that it’s a bit weird, but I use a guix shell on my first run to kick off fcitx5-configtool in order to add pinyin to my IME list. This way I dont have to suck in a bunch of kde dependencies that seem to only get included for this one package. After it’s set up I can collect garbage and no longer have that stuff lying around. Too bad I dont know a declarative way to just state what IMEs should exist for the user.

And then environment variables in my home services:

                         (service home-bash-service-type
                             (environment-variables '(
                             ;; other vriables elided here ...
                             ;; Kitty is still dumb in x, have to have fcitx pretend to be ibus.
                                                    ("GLFW_IM_MODULE" . "ibus")
                                                    ("SDL_IM_MODULE" . "ibus")
                                                    ("GTK_IM_MODULE" . "ibus")
                                                    ("QT_IM_MODULE" . "ibus")
                                                    ("XMODIFIERS" . "@im=ibus"))
                          ))

In wayland, things are okay with kitty and fcitx, but in xorg I needed to have kitty use a fallback that it has for ibus. Fcitx is smart and has no problem masquerading as ibus. If I run this exact setup in both wayland/sway and xorg/i3, everything is fine, so I just use the same setup for X and Wayland systems. (The one caveat is using hyprland on other *nix will complain about some of these variables being set, but it keeps it compatible everywhere so I just ignore the brief complaints at startup.)

One issue I haven’t overcome with this setup is broken qt stuff. I prefer to use qutebrowser, but right now I can’t do IME with qutebrowser. I recall having some kind of a workaround for this forever ago on ubuntu and nix, but I can’t recall what that workaround was so I don’t know if it’s the same thing @hako alluded to above.

The issue with QT is that both QT5 and QT6 uses the same QT_PLUGIN_PATH environment variable for their search paths. However they’re not compatible, for example, QT6 applications will crash if loading QT5 plugins from the search path.

Currently you’ll need to ensure QT_PLUGIN_PATH is not set for your running environment and use guix shell to manage it instead. Here I write about fcitx5, you’ll need to figure out which package provides the ibus QT plugin.

The fcitx5-qt package provides both QT5 and QT6 plugins:

find "$(guix build fcitx5-qt)" -wholename '*lib/qt*'
/gnu/store/p3c0alzx00gcr758y4x9y5wc0qlwwlz8-fcitx5-qt-5.1.13/lib/qt5
/gnu/store/p3c0alzx00gcr758y4x9y5wc0qlwwlz8-fcitx5-qt-5.1.13/lib/qt5/plugins
/gnu/store/p3c0alzx00gcr758y4x9y5wc0qlwwlz8-fcitx5-qt-5.1.13/lib/qt5/plugins/platforminputcontexts
/gnu/store/p3c0alzx00gcr758y4x9y5wc0qlwwlz8-fcitx5-qt-5.1.13/lib/qt5/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so
/gnu/store/p3c0alzx00gcr758y4x9y5wc0qlwwlz8-fcitx5-qt-5.1.13/lib/qt6
/gnu/store/p3c0alzx00gcr758y4x9y5wc0qlwwlz8-fcitx5-qt-5.1.13/lib/qt6/plugins
/gnu/store/p3c0alzx00gcr758y4x9y5wc0qlwwlz8-fcitx5-qt-5.1.13/lib/qt6/plugins/platforminputcontexts
/gnu/store/p3c0alzx00gcr758y4x9y5wc0qlwwlz8-fcitx5-qt-5.1.13/lib/qt6/plugins/platforminputcontexts/libfcitx5platforminputcontextplugin.so

And qutebrowser uses QT6:

guix graph --path qutebrowser qtbase@6
qutebrowser@3.6.3
python-pyqt@6.9.1
qtbase@6.9.2

Then you can launch qutebrowser via guix shell (the qtbase package provides QT_PLUGIN_PATH search path):

guix shell qtbase@6 fcitx5-qt qutebrowser -- qutebrowser

Likewise for QT5, here I use picard as the example:

guix graph --path picard qtbase@5
picard@2.13.3
python-pyqt@5.15.11
qtbase@5.15.17

guix shell invocation for it:

guix shell qtbase@5 fcitx5-qt picard -- picard

@teal Thank you. I didn’t realize kitty didn’t use gtk (or qt), but rather it uses GLFW.

@hako Thank you. I thought I had it figured out, and then you posted some more information on qt which just shed more light on my ignorance. :slight_smile: Appreciate having a resource like you around. Thanks.