diff --git a/lib/images/macos/templates/profile/default.nix b/lib/images/macos/templates/profile/default.nix index f9c952e..fa663c2 100644 --- a/lib/images/macos/templates/profile/default.nix +++ b/lib/images/macos/templates/profile/default.nix @@ -36,12 +36,16 @@ rec { D com.apple.widgets widgetAppearance -int 0 ''} ${lib.optionalString (wallpaper != null) '' - W="/Library/Desktop Pictures/vmix-wallpaper.${lib.last (lib.splitString "." (baseNameOf (toString wallpaper)))}" - mkdir -p "/Library/Desktop Pictures"; cp "$V/wallpaper".* "$W"; chmod 644 "$W" + # WallpaperAgent only keeps choices whose file lives in the user's own space + # ("No files include in the descriptor" for /Library/Desktop Pictures) + HP="$H/Pictures"; mkdir -p "$HP" + W="$HP/vmix-wallpaper.${lib.last (lib.splitString "." (baseNameOf (toString wallpaper)))}" + cp "$V/wallpaper".* "$W"; chown "$CONSOLE_USER" "$HP" "$W"; chmod 644 "$W" installer -pkg "$V/desktoppr.pkg" -target / >/dev/null || echo "vmix: WARNING: desktoppr install failed" as_user /usr/local/bin/desktoppr "$W" || echo "vmix: WARNING: could not set the wallpaper" - # the wallpaper store is written asynchronously; give it time before the shutdown - sleep 15 + # the wallpaper store (~/Library/Application Support/com.apple.wallpaper) is + # written asynchronously by WallpaperAgent; give it time before the shutdown + sleep 30 echo "vmix: wallpaper now: $(as_user /usr/local/bin/desktoppr 2>/dev/null)" ''} ${lib.optionalString (dockApps != null) ''