diff --git a/modules/desktop/themes/catppuccin/default.nix b/modules/desktop/themes/catppuccin/default.nix index 42ac2a6..646f6d5 100644 --- a/modules/desktop/themes/catppuccin/default.nix +++ b/modules/desktop/themes/catppuccin/default.nix @@ -36,6 +36,11 @@ in { }; }; + qtctTheme = { + name = "catppuccin-${variant}-${accent}"; + package = pkgs.catppuccin-qt5ct; + }; + iconTheme = { name = "WhiteSur-${darkString}"; package = pkgs.whitesur-icon-theme; diff --git a/modules/desktop/themes/default.nix b/modules/desktop/themes/default.nix index b155dc9..34a6b30 100644 --- a/modules/desktop/themes/default.nix +++ b/modules/desktop/themes/default.nix @@ -25,6 +25,10 @@ in { name = mkOpt (nullOr str) null; package = mkOpt (nullOr package) null; }; + qtctTheme = { + name = mkOpt (nullOr str) null; + package = mkOpt (nullOr package) null; + }; iconTheme = { name = mkOpt (nullOr str) null; package = mkOpt (nullOr package) null; @@ -176,25 +180,27 @@ in { }; hm.xdg.configFile = let - iniFmt = pkgs.formats.ini {}; - # souls are forged in the fires of hell mkQtctConf = version: let zeroCount = if version == 5 then 5 else if version == 6 then 10 else builtins.throw "invalid qtct version"; zeros = builtins.concatStringsSep "," (builtins.genList (_: "0") zeroCount); weight = if version == 5 then 50 else if version == 6 then 400 else builtins.throw "invalid qtct version"; - in { + in builtins.concatStringsSep "\n" ([ (lib.generators.toINI {} { Appearance = { icon_theme = cfg.iconTheme.name; + custom_palette = cfg.qtctTheme.name != null; + style = "kvantum"; # do this unconditionally, fixes qt5ct/qt6ct config uis standard_dialogs = "xdgdesktopportal"; - style = "kvantum"; # its ok if this is always the case, override it anyway }; Fonts = with config.modules.desktop.fonts.fonts; { general = ''"${sansSerif.family},${toString sansSerif.size},-1,5,${toString weight},${zeros},1"''; fixed = ''"${monospace.family},-1,${toString monospace.size},5,${toString weight},${zeros},1"''; }; - }; + + # this could technically be under a completely different path + # whatever. works ok + }) ] ++ lib.optional (cfg.qtctTheme.name != null) (builtins.readFile "${cfg.qtctTheme.package}/share/qt${builtins.toString version}ct/colors/${cfg.qtctTheme.name}.conf")); in mkMerge [ { # technically could cause issues with KDE if we use that @@ -204,8 +210,8 @@ in { Theme=${cfg.iconTheme.name} ''; - "qt5ct/qt5ct.conf".source = iniFmt.generate "qt5ct.conf" (mkQtctConf 5); - "qt6ct/qt6ct.conf".source = iniFmt.generate "qt6ct.conf" (mkQtctConf 6); + "qt5ct/qt5ct.conf".text = mkQtctConf 5; + "qt6ct/qt6ct.conf".text = mkQtctConf 6; } (mkIf (cfg.kvantumTheme.name != null) { "Kvantum/${cfg.kvantumTheme.name}".source = "${cfg.kvantumTheme.package}/share/Kvantum/${cfg.kvantumTheme.name}";