1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-30 06:59:45 +01:00

qt: workaround issue when i18n.inputMethod.enabled = 'fcitx5'

This commit is contained in:
Thiago Kenji Okada 2023-10-18 16:15:49 +01:00
parent 4b2d3b03be
commit 3452e14ec7
3 changed files with 12 additions and 6 deletions

View file

@ -28,8 +28,9 @@ in {
GTK_IM_MODULE = "fcitx";
QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
QT_PLUGIN_PATH =
"${fcitx5Package}/${pkgs.qt6.qtbase.qtPluginPrefix}:\${QT_PLUGIN_PATH}";
# Using mkDefault here since we override this value in qt module if enabled
QT_PLUGIN_PATH = lib.mkDefault
"$QT_PLUGIN_PATH\${QT_PLUGIN_PATH:+:}${fcitx5Package}/${pkgs.qt6.qtbase.qtPluginPrefix}";
};
systemd.user.services.fcitx5-daemon = {

View file

@ -130,6 +130,7 @@ in {
envVars = let
inherit (config.home) profileDirectory;
qtVersions = with pkgs; [ qt5 qt6 ];
makeQtPath = prefix: basePath: qt: "${basePath}/${qt.qtbase.${prefix}}";
in lib.filterAttrs (n: v: v != null) {
QT_QPA_PLATFORMTHEME = if cfg.platformTheme == "gtk" then
"gtk2"
@ -140,12 +141,15 @@ in {
QT_STYLE_OVERRIDE = cfg.style.name;
QT_PLUGIN_PATH = "$QT_PLUGIN_PATH\${QT_PLUGIN_PATH:+:}"
+ (lib.concatStringsSep ":"
(map (qt: "${profileDirectory}/${qt.qtbase.qtPluginPrefix}")
qtVersions));
# Workaround issue with home.sessionVariables that does not support
# multiple different values since fcitx5 also needs to set QT_PLUGIN_PATH.
(lib.optional (config.i18n.inputMethod == "fcitx5")
(makeQtPath "qtPluginPrefix" config.i18n.inputMethod.package
pkgs.qt6) ++ (map (makeQtPath "qtPluginPrefix" profileDirectory)
qtVersions)));
QML2_IMPORT_PATH = "$QML2_IMPORT_PATH\${QML2_IMPORT_PATH:+:}"
+ (lib.concatStringsSep ":"
(map (qt: "${profileDirectory}/${qt.qtbase.qtQmlPrefix}")
qtVersions));
(map (makeQtPath "qtQmlPrefix" profileDirectory) qtVersions));
};
in lib.mkIf (cfg.enable && cfg.platformTheme != null) {

View file

@ -6,6 +6,7 @@
enable = true;
platformTheme = "gtk";
};
i18n.inputMethod.enabled = "fcitx5";
nmt.script = ''
assertFileRegex home-path/etc/profile.d/hm-session-vars.sh \