mirror of
https://github.com/nix-community/home-manager
synced 2024-11-11 05:39:44 +01:00
qt: simplify style.name mappings
This commit is contained in:
parent
ad4a26ae2f
commit
418475f3b9
1 changed files with 9 additions and 6 deletions
|
@ -3,6 +3,7 @@
|
||||||
let
|
let
|
||||||
cfg = config.qt;
|
cfg = config.qt;
|
||||||
|
|
||||||
|
# Map platform names to their packages.
|
||||||
platformPackages = with pkgs; {
|
platformPackages = with pkgs; {
|
||||||
gnome = [ qgnomeplatform qgnomeplatform-qt6 ];
|
gnome = [ qgnomeplatform qgnomeplatform-qt6 ];
|
||||||
gtk = [ libsForQt5.qtstyleplugins qt6Packages.qt6gtk2 ];
|
gtk = [ libsForQt5.qtstyleplugins qt6Packages.qt6gtk2 ];
|
||||||
|
@ -11,6 +12,12 @@ let
|
||||||
qtct = [ libsForQt5.qt5ct qt6Packages.qt6ct ];
|
qtct = [ libsForQt5.qt5ct qt6Packages.qt6ct ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Maps style names to their QT_QPA_PLATFORMTHEME, if necessary.
|
||||||
|
styleNames = {
|
||||||
|
gtk = "gtk2";
|
||||||
|
qtct = "qt5ct";
|
||||||
|
};
|
||||||
|
|
||||||
# Maps known lowercase style names to style packages. Non-exhaustive.
|
# Maps known lowercase style names to style packages. Non-exhaustive.
|
||||||
stylePackages = with pkgs; {
|
stylePackages = with pkgs; {
|
||||||
bb10bright = libsForQt5.qtstyleplugins;
|
bb10bright = libsForQt5.qtstyleplugins;
|
||||||
|
@ -152,12 +159,8 @@ in {
|
||||||
qtVersions = with pkgs; [ qt5 qt6 ];
|
qtVersions = with pkgs; [ qt5 qt6 ];
|
||||||
makeQtPath = prefix: basePath: qt: "${basePath}/${qt.qtbase.${prefix}}";
|
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 =
|
||||||
"gtk2"
|
styleNames.${cfg.platformTheme} or cfg.platformTheme;
|
||||||
else if cfg.platformTheme == "qtct" then
|
|
||||||
"qt5ct"
|
|
||||||
else
|
|
||||||
cfg.platformTheme;
|
|
||||||
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 ":"
|
||||||
|
|
Loading…
Reference in a new issue