diff --git a/modules/i18n/input-method/fcitx5.nix b/modules/i18n/input-method/fcitx5.nix index 3c2d1c191..9d5ad85a7 100644 --- a/modules/i18n/input-method/fcitx5.nix +++ b/modules/i18n/input-method/fcitx5.nix @@ -18,6 +18,15 @@ in { Enabled Fcitx5 addons. ''; }; + + waylandFrontend = mkOption { + type = types.bool; + default = false; + description = '' + Use the Wayland input method frontend. + See [Using Fcitx 5 on Wayland](https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland). + ''; + }; }; }; @@ -26,11 +35,12 @@ in { home.sessionVariables = { GLFW_IM_MODULE = "ibus"; # IME support in kitty - GTK_IM_MODULE = "fcitx"; - QT_IM_MODULE = "fcitx"; XMODIFIERS = "@im=fcitx"; QT_PLUGIN_PATH = "$QT_PLUGIN_PATH\${QT_PLUGIN_PATH:+:}${fcitx5Package}/${pkgs.qt6.qtbase.qtPluginPrefix}"; + } // lib.optionalAttrs (!cfg.waylandFrontend) { + GTK_IM_MODULE = "fcitx"; + QT_IM_MODULE = "fcitx"; }; systemd.user.services.fcitx5-daemon = { diff --git a/tests/modules/i18n/input-method/fcitx5-configuration.nix b/tests/modules/i18n/input-method/fcitx5-configuration.nix index 59738fb01..00e8692ce 100644 --- a/tests/modules/i18n/input-method/fcitx5-configuration.nix +++ b/tests/modules/i18n/input-method/fcitx5-configuration.nix @@ -6,9 +6,12 @@ i18n.inputMethod = { enabled = "fcitx5"; fcitx5.addons = with pkgs; [ fcitx5-chinese-addons ]; + fcitx5.waylandFrontend = true; }; nmt.script = '' assertFileExists home-files/.config/systemd/user/fcitx5-daemon.service + assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh 'GTK_IM_MODULE' + assertFileNotRegex home-path/etc/profile.d/hm-session-vars.sh 'QT_IM_MODULE' ''; }