fcitx5: add waylandFrontend option to not set env vars

This commit is contained in:
void 2024-05-22 23:24:21 +09:00
parent e3ad5108f5
commit befd927ddc
2 changed files with 15 additions and 2 deletions

View file

@ -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 = {

View file

@ -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'
'';
}