Skip to content

Commit

Permalink
feat(home-manager/hyprland): source theme + accent
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Liassica committed Mar 17, 2024
1 parent 948fe71 commit 238a056
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions modules/home-manager/hyprland.nix
Original file line number Diff line number Diff line change
@@ -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
'')
];
};
}

0 comments on commit 238a056

Please sign in to comment.