From befd927ddc0d6884c29b5379f2598cdb2351de13 Mon Sep 17 00:00:00 2001 From: void Date: Wed, 22 May 2024 23:24:21 +0900 Subject: [PATCH] fcitx5: add waylandFrontend option to not set env vars --- modules/i18n/input-method/fcitx5.nix | 14 ++++++++++++-- .../i18n/input-method/fcitx5-configuration.nix | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/i18n/input-method/fcitx5.nix b/modules/i18n/input-method/fcitx5.nix index 3c2d1c19..9d5ad85a 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 59738fb0..00e8692c 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' ''; }