fix(qt): allow theming for apps started by systemd (#4349)
This commit is contained in:
parent
2471d965a3
commit
6a94c1a597
|
@ -128,7 +128,20 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf (cfg.enable && cfg.platformTheme != null) {
|
config = let
|
||||||
|
|
||||||
|
# Necessary because home.sessionVariables doesn't support mkIf
|
||||||
|
envVars = filterAttrs (n: v: v != null) {
|
||||||
|
QT_QPA_PLATFORMTHEME = if cfg.platformTheme == "gtk" then
|
||||||
|
"gtk2"
|
||||||
|
else if cfg.platformTheme == "qtct" then
|
||||||
|
"qt5ct"
|
||||||
|
else
|
||||||
|
cfg.platformTheme;
|
||||||
|
QT_STYLE_OVERRIDE = cfg.style.name;
|
||||||
|
};
|
||||||
|
|
||||||
|
in mkIf (cfg.enable && cfg.platformTheme != null) {
|
||||||
assertions = [{
|
assertions = [{
|
||||||
assertion = cfg.platformTheme == "gnome" -> cfg.style.name != null
|
assertion = cfg.platformTheme == "gnome" -> cfg.style.name != null
|
||||||
&& cfg.style.package != null;
|
&& cfg.style.package != null;
|
||||||
|
@ -141,16 +154,10 @@ in {
|
||||||
qt.style.package = mkIf (cfg.style.name != null)
|
qt.style.package = mkIf (cfg.style.name != null)
|
||||||
(mkDefault (stylePackages.${toLower cfg.style.name} or null));
|
(mkDefault (stylePackages.${toLower cfg.style.name} or null));
|
||||||
|
|
||||||
# Necessary because home.sessionVariables doesn't support mkIf
|
home.sessionVariables = envVars;
|
||||||
home.sessionVariables = filterAttrs (n: v: v != null) {
|
|
||||||
QT_QPA_PLATFORMTHEME = if cfg.platformTheme == "gtk" then
|
# Apply theming also to apps started by systemd.
|
||||||
"gtk2"
|
systemd.user.sessionVariables = envVars;
|
||||||
else if cfg.platformTheme == "qtct" then
|
|
||||||
"qt5ct"
|
|
||||||
else
|
|
||||||
cfg.platformTheme;
|
|
||||||
QT_STYLE_OVERRIDE = cfg.style.name;
|
|
||||||
};
|
|
||||||
|
|
||||||
home.packages = (if cfg.platformTheme == "gnome" then
|
home.packages = (if cfg.platformTheme == "gnome" then
|
||||||
[ pkgs.qgnomeplatform ]
|
[ pkgs.qgnomeplatform ]
|
||||||
|
|
Loading…
Reference in a new issue