qt: add "kde" to qt.platformTheme (#4085)
This allow you to configure Qt integration using KDE instead of qgnomeplatform or qtstyleplugins. Useful if your theme supports both GTK and KDE, for example Nordic. To use this properly you will need to do some manual configuration for now. You can set the theme settings using `~/.config/kdeglobals`. Example: ```nix { ... }: { qt = { enable = true; platformTheme = "kde"; }; xdg = { configFile.kdeglobals.text = lib.generators.toINI { } { General = { ColorScheme = "nordicbluish"; Name = "nordic-bluish"; shadeSortColumn = true; }; Icons = { Theme = "Nordic-bluish"; }; KDE = { LookAndFeelPackage = "Nordic-bluish"; contrast = 4; }; }; dataFile = { # For General.ColorScheme color-schemes = { source = "${pkgs.nordic}/share/color-schemes"; recursive = true; }; # For KDE.LookAndFeelPackage plasma = { source = "${pkgs.nordic}/share/plasma"; recursive = true; }; }; }; } ```
This commit is contained in:
parent
75b24cc557
commit
32376992f7
|
@ -38,7 +38,7 @@ in {
|
|||
enable = mkEnableOption "Qt 4 and 5 configuration";
|
||||
|
||||
platformTheme = mkOption {
|
||||
type = types.nullOr (types.enum [ "gtk" "gnome" ]);
|
||||
type = types.nullOr (types.enum [ "gtk" "gnome" "kde" ]);
|
||||
default = null;
|
||||
example = "gnome";
|
||||
relatedPackages =
|
||||
|
@ -59,6 +59,10 @@ in {
|
|||
<link xlink:href="https://github.com/FedoraQt/QGnomePlatform">qgnomeplatform</link>
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><literal>kde</literal></term>
|
||||
<listitem><para>Use Qt settings from Plasma</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
'';
|
||||
};
|
||||
|
@ -134,14 +138,17 @@ in {
|
|||
# Necessary because home.sessionVariables doesn't support mkIf
|
||||
home.sessionVariables = filterAttrs (n: v: v != null) {
|
||||
QT_QPA_PLATFORMTHEME =
|
||||
if cfg.platformTheme == "gnome" then "gnome" else "gtk2";
|
||||
if cfg.platformTheme == "gtk" then "gtk2" else cfg.platformTheme;
|
||||
QT_STYLE_OVERRIDE = cfg.style.name;
|
||||
};
|
||||
|
||||
home.packages = if cfg.platformTheme == "gnome" then
|
||||
[ pkgs.qgnomeplatform ]
|
||||
++ lib.optionals (cfg.style.package != null) [ cfg.style.package ]
|
||||
else
|
||||
else if cfg.platformTheme == "kde" then [
|
||||
pkgs.libsForQt5.plasma-integration
|
||||
pkgs.libsForQt5.systemsettings
|
||||
] else
|
||||
[ pkgs.libsForQt5.qtstyleplugins ];
|
||||
|
||||
xsession.importedVariables = [ "QT_QPA_PLATFORMTHEME" ]
|
||||
|
|
Loading…
Reference in a new issue