From 238a05659fafc47487ce1ac74635ee651530b7d8 Mon Sep 17 00:00:00 2001 From: Liassica Date: Sun, 17 Mar 2024 13:08:45 -0500 Subject: [PATCH] feat(home-manager/hyprland): source theme + accent Since Home Manager defbb9c, Hyprland on Home Manager now sources files before most other configuration, meaning ctp-nix can now source a theme colors file instead of inserting them into the main configuration. In addition, accent and accentAlpha color variables have been added in a second sourced file. --- modules/home-manager/hyprland.nix | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/home-manager/hyprland.nix b/modules/home-manager/hyprland.nix index e51c08c3..e694591a 100644 --- a/modules/home-manager/hyprland.nix +++ b/modules/home-manager/hyprland.nix @@ -1,19 +1,21 @@ -{ config -, lib -, sources -, ... -}: +{ config, lib, sources, ... }: let cfg = config.wayland.windowManager.hyprland.catppuccin; enable = cfg.enable && config.wayland.windowManager.hyprland.enable; in { options.wayland.windowManager.hyprland.catppuccin = - lib.ctp.mkCatppuccinOpt "hyprland"; + lib.ctp.mkCatppuccinOpt "hyprland" // { + accent = lib.ctp.mkAccentOpt "hyprland"; + }; - # Because of how nix merges options and hyprland interprets options, sourcing - # the file does not work. instead, parse the theme and put it in settings so - # the variables appear early enough in the file to be applied properly. - config.wayland.windowManager.hyprland.settings = lib.mkIf enable - (lib.ctp.fromINI (sources.hyprland + /themes/${cfg.flavour}.conf)); + config.wayland.windowManager.hyprland.settings = lib.mkIf enable { + source = [ + "${sources.hyprland}/themes/${cfg.flavour}.conf" + (builtins.toFile "hyprland-${cfg.accent}-accent.conf" '' + $accent=''$${cfg.accent} + $accentAlpha=''$${cfg.accent}Alpha + '') + ]; + }; }