{ config, pkgs, inputs, lib, ... }: let # Re-use our state-based logic palettes = import ../../themes/nomarchy-palettes.nix; themeStateFile = "${config.home.homeDirectory}/.config/home-manager/theme-state.nix"; activeThemeName = if builtins.pathExists themeStateFile then lib.removeSuffix "\n" (builtins.readFile themeStateFile) else "dracula"; wallpaperStateFile = "${config.home.homeDirectory}/.config/home-manager/wallpaper-state.nix"; activeWallpaper = if builtins.pathExists wallpaperStateFile then lib.removeSuffix "\n" (builtins.readFile wallpaperStateFile) else "${../../themes/catppuccin/backgrounds/1-totoro.png}"; # Fallback # Map nix-colors palette to a format Stylix expects (attrset of hex strings) currentPalette = (palettes.${activeThemeName} or palettes.dracula).palette; in { imports = [ inputs.stylix.homeModules.stylix ]; stylix = { enable = true; image = activeWallpaper; base16Scheme = currentPalette; # Force dark/light mode based on theme name if possible, or just default to dark polarity = if lib.strings.hasInfix "light" activeThemeName then "light" else "dark"; cursor = { package = pkgs.bibata-cursors; name = "Bibata-Modern-Ice"; size = 24; }; fonts = { monospace = { package = pkgs.nerd-fonts.jetbrains-mono; name = config.nomarchy.fonts.monospace; }; sansSerif = { package = pkgs.dejavu_fonts; name = "DejaVu Sans"; }; serif = { package = pkgs.dejavu_fonts; name = "DejaVu Serif"; }; emoji = { package = pkgs.noto-fonts-color-emoji; name = "Noto Color Emoji"; }; sizes = { applications = 11; terminal = 11; desktop = 11; popups = 11; }; }; # Enable theming for specific targets targets = { hyprland.enable = false; # We keep our custom hyprland config for borders/rules waybar.enable = false; # We keep our custom waybar CSS alacritty.enable = true; kitty.enable = true; gtk.enable = true; gnome.enable = true; }; }; }