diff --git a/modules/home-manager/kvantum.nix b/modules/home-manager/kvantum.nix new file mode 100644 index 0000000..2fed919 --- /dev/null +++ b/modules/home-manager/kvantum.nix @@ -0,0 +1,47 @@ +{ + config, + lib, + pkgs, + ... +}: +let + cfg = config.qt.style.catppuccin; + enable = + cfg.enable + && config.qt.enable + && lib.elem config.qt.style.name [ + "kvantum" + "Kvantum" + ]; + flavorCapitalized = lib.ctp.mkUpper cfg.flavor; + accentCapitalized = lib.ctp.mkUpper cfg.accent; + theme = pkgs.catppuccin-kvantum.override { + accent = accentCapitalized; + variant = flavorCapitalized; + }; + themeName = "Catppuccin-${flavorCapitalized}-${accentCapitalized}"; +in +{ + options.qt.style.catppuccin = lib.ctp.mkCatppuccinOpt "Kvantum" // { + accent = lib.ctp.mkAccentOpt "Kvantum"; + + apply = lib.mkOption { + type = lib.types.bool; + default = true; + description = '' + Applies the theme by overwriting `$XDG_CONFIG_HOME/Kvantum/kvantum.kvconfig`. + If this is disabled, you must manually set the theme (e.g. by using `kvantummanager`). + ''; + }; + }; + + config.xdg.configFile = lib.mkIf enable { + "Kvantum/${themeName}".source = "${theme}/share/Kvantum/${themeName}"; + "Kvantum/kvantum.kvconfig" = lib.mkIf cfg.apply { + text = '' + [General] + theme=${themeName} + ''; + }; + }; +} diff --git a/test.nix b/test.nix index b2be30d..ecbea7d 100644 --- a/test.nix +++ b/test.nix @@ -121,6 +121,10 @@ testers.runNixOSTest { gtk = lib.recursiveUpdate enable { catppuccin.cursor.enable = true; }; + qt = enable // { + style.name = "kvantum"; + }; + services = { dunst = enable; mako = enable;