From 96fb7dc789cd98ac8ad2e66c0ae7a83c5566adf0 Mon Sep 17 00:00:00 2001 From: Lichthagel Date: Fri, 17 May 2024 14:54:05 +0200 Subject: [PATCH] feat(home-manager): add support for kvantum --- modules/home-manager/kvantum.nix | 43 ++++++++++++++++++++++++++++++++ test.nix | 2 ++ 2 files changed, 45 insertions(+) create mode 100644 modules/home-manager/kvantum.nix diff --git a/modules/home-manager/kvantum.nix b/modules/home-manager/kvantum.nix new file mode 100644 index 00000000..e4e82dde --- /dev/null +++ b/modules/home-manager/kvantum.nix @@ -0,0 +1,43 @@ +{ config +, lib +, pkgs +, ... +}: +let + cfg = config.qt.catppuccin-kvantum; + enable = cfg.enable && config.qt.enable; + flavourCapitalized = lib.ctp.mkUpper cfg.flavour; + accentCapitalized = lib.ctp.mkUpper cfg.accent; + theme = pkgs.catppuccin-kvantum.override { + accent = accentCapitalized; + variant = flavourCapitalized; + }; +in +{ + options.qt.catppuccin-kvantum = 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 = lib.mkIf enable { + qt.style.name = "kvantum"; + + xdg.configFile = { + "Kvantum/Catppuccin-${flavourCapitalized}-${accentCapitalized}".source = "${theme}/share/Kvantum/Catppuccin-${flavourCapitalized}-${accentCapitalized}"; + "Kvantum/kvantum.kvconfig" = lib.mkIf cfg.apply { + text = '' + [General] + theme=Catppuccin-${flavourCapitalized}-${accentCapitalized} + ''; + }; + }; + }; +} diff --git a/test.nix b/test.nix index 59022d18..9114554b 100644 --- a/test.nix +++ b/test.nix @@ -115,6 +115,8 @@ testers.runNixOSTest { gtk = lib.recursiveUpdate enable { catppuccin.cursor.enable = true; }; + qt = enable; + services = { dunst = enable; mako = enable;