{ user ? throw "user argument is required" }: { config, pkgs, ... }: let hmConfig = config.home-manager.users."${user.name}"; in { home-manager.users."${user.name}" = { home = { packages = with pkgs; [ swww ]; persistence."/cache${user.home}".directories = [ "${hmConfig.xdg.relativeCacheHome}/swww" ]; }; theme.extraConfig = let name = "theme-swww"; in "${pkgs.writeShellApplication { inherit name; runtimeInputs = with pkgs; [ coreutils-full swww ]; text = '' if ! pgrep -x "swww-daemon" > /dev/null; then swww-daemon &> /tmp/swww.log & fi while ! swww query &> /dev/null; do sleep 0.1 done swww img "${hmConfig.theme.configDir}/wallpaper" ''; }}/bin/${name}"; }; }