1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-26 03:39:47 +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 committed by Mikilio
parent 89acf6a4f9
commit e529050043
No known key found for this signature in database
GPG key ID: 5B2F1A890CF33F3F
3 changed files with 12 additions and 6 deletions

View file

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

View file

@ -130,6 +130,7 @@ in {
envVars = let envVars = let
inherit (config.home) profileDirectory; inherit (config.home) profileDirectory;
qtVersions = with pkgs; [ qt5 qt6 ]; qtVersions = with pkgs; [ qt5 qt6 ];
makeQtPath = prefix: basePath: qt: "${basePath}/${qt.qtbase.${prefix}}";
in lib.filterAttrs (n: v: v != null) { in lib.filterAttrs (n: v: v != null) {
QT_QPA_PLATFORMTHEME = if cfg.platformTheme == "gtk" then QT_QPA_PLATFORMTHEME = if cfg.platformTheme == "gtk" then
"gtk2" "gtk2"
@ -140,12 +141,15 @@ in {
QT_STYLE_OVERRIDE = cfg.style.name; QT_STYLE_OVERRIDE = cfg.style.name;
QT_PLUGIN_PATH = "$QT_PLUGIN_PATH\${QT_PLUGIN_PATH:+:}" QT_PLUGIN_PATH = "$QT_PLUGIN_PATH\${QT_PLUGIN_PATH:+:}"
+ (lib.concatStringsSep ":" + (lib.concatStringsSep ":"
(map (qt: "${profileDirectory}/${qt.qtbase.qtPluginPrefix}") # Workaround issue with home.sessionVariables that does not support
qtVersions)); # 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:+:}" QML2_IMPORT_PATH = "$QML2_IMPORT_PATH\${QML2_IMPORT_PATH:+:}"
+ (lib.concatStringsSep ":" + (lib.concatStringsSep ":"
(map (qt: "${profileDirectory}/${qt.qtbase.qtQmlPrefix}") (map (makeQtPath "qtQmlPrefix" profileDirectory) qtVersions));
qtVersions));
}; };
in lib.mkIf (cfg.enable && cfg.platformTheme != null) { in lib.mkIf (cfg.enable && cfg.platformTheme != null) {

View file

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