From ceb396283367cb79b76e4902ac9cf35ef13506a9 Mon Sep 17 00:00:00 2001 From: Danilo Reyes Date: Sun, 8 Jun 2025 18:10:07 -0600 Subject: [PATCH] more robust logic for stylix theme picking --- stylix.nix | 62 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/stylix.nix b/stylix.nix index 7ba507f..c60e23c 100644 --- a/stylix.nix +++ b/stylix.nix @@ -5,27 +5,63 @@ ... }: let - cfg = config.my.stylix; - mkScheme = color: name: polarity: image: { - inherit name polarity image; - iconPackage = pkgs.papirus-icon-theme.override { inherit color; }; - base16Scheme = "${pkgs.base16-schemes}/share/themes/${name}.yaml"; - }; - schemes = { - who = mkScheme "orange" "catppuccin-frappe" "dark" ./wallpapers/Nikolay_Kasatkin_Who.jpeg; - jesus = mkScheme "red" "equilibrium-light" "light" ./wallpapers/jesus.png; - ballerinas = mkScheme "brown" "mocha" "dark" ./wallpapers/Waay-Ballerinas.jpeg; - }; scheme = schemes.ballerinas; + cfg = config.my.stylix; + mkScheme = + { + color ? null, + name ? null, + polarity, + image, + iconPackage ? pkgs.papirus-icon-theme.override { inherit color; }, + }: + { + inherit + name + polarity + image + iconPackage + ; + base16Scheme = if name != null then "${pkgs.base16-schemes}/share/themes/${name}.yaml" else null; + }; + schemes = { + who = mkScheme { + name = "catppuccin-frappe"; + polarity = "dark"; + image = ./wallpapers/Nikolay_Kasatkin_Who.jpeg; + iconPackage = pkgs.catppuccin-papirus-folders.override { + flavor = "frappe"; + accent = "peach"; + }; + }; + space = mkScheme { + name = "solarflare"; + color = "carmine"; + polarity = "dark"; + image = ./wallpapers/space.jpg; + }; + jesus = mkScheme { + color = "red"; + name = "equilibrium-light"; + polarity = "light"; + image = ./wallpapers/jesus.png; + }; + ballerinas = mkScheme { + color = "brown"; + name = "mocha"; + polarity = "dark"; + image = ./wallpapers/Waay-Ballerinas.jpeg; + }; + }; in { options.my.stylix.enable = lib.mkEnableOption "enable"; config = { stylix = { - inherit (scheme) image polarity base16Scheme; + inherit (scheme) image polarity; enable = cfg.enable; targets.qt.platform = lib.mkForce "qtct"; - }; + } // lib.optionalAttrs (scheme ? base16Scheme) { inherit (scheme) base16Scheme; }; home-manager.users.jawz = { gtk = lib.mkIf (!cfg.enable) { iconTheme = scheme.iconPackage;