# Wallpaper-driven Material-You theming (matugen) for the QuickShell shell. # `qs-theme ` regenerates: # - ~/.cache/quickshell/theme.json → live-repaints the bar (FileView watcher) # - ~/.config/kitty/colors.conf → kitty palette + ANSI 16 # The Nix-declared colors.conf symlink is restored on the next home-manager # rebuild; until then the generated palette wins (see the rm in qs-theme). { config, pkgs, ... }: { home.packages = [ pkgs.matugen ]; # Default matugen config — renders our two templates on every run. xdg.configFile."matugen/config.toml".text = '' [config] [templates.quick-shell] input_path = "${config.home.homeDirectory}/.config/matugen/themes/theme.json.template" output_path = "${config.home.homeDirectory}/.cache/quickshell/theme.json" [templates.kitty] input_path = "${config.home.homeDirectory}/.config/matugen/themes/kitty-colors.conf.template" output_path = "${config.home.homeDirectory}/.config/kitty/colors.conf" ''; # Template sources live in the repo so matugen can read them at runtime. xdg.configFile."matugen/themes/theme.json.template".text = builtins.readFile ./matugen-themes/theme.json.template; xdg.configFile."matugen/themes/kitty-colors.conf.template".text = builtins.readFile ./matugen-themes/kitty-colors.conf.template; # qs-theme — regenerate the wallpaper palette, then repaint the live bar. home.file.".local/bin/qs-theme" = { executable = true; text = '' #!/bin/sh # Regenerate the Material-You palette (QuickShell bar + kitty) from a # wallpaper. The bar picks it up live via its theme.json watcher. set -e if [ "$#" -lt 1 ]; then echo "usage: qs-theme " >&2 exit 1 fi # matugen refuses to overwrite the Nix-declared symlink; unlink it first # (home-manager restores it on the next rebuild). rm -f "$HOME/.config/kitty/colors.conf" exec ${pkgs.matugen}/bin/matugen image "$1" -m dark --prefer darkness ''; }; }