macOS profile: stage the wallpaper in the user's ~/Pictures

WallpaperAgent drops choices whose file is outside the user's space
("No files include in the descriptor" for /Library/Desktop Pictures); from
~/Pictures the choice is written to the wallpaper store and persists.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XsESshRCoBoUVWV9qKURUF
This commit is contained in:
Git Sagar 2026-09-09 22:54:05 -03:00
parent e6e2e9f18d
commit 9936b92012

View file

@ -36,12 +36,16 @@ rec {
D com.apple.widgets widgetAppearance -int 0 D com.apple.widgets widgetAppearance -int 0
''} ''}
${lib.optionalString (wallpaper != null) '' ${lib.optionalString (wallpaper != null) ''
W="/Library/Desktop Pictures/vmix-wallpaper.${lib.last (lib.splitString "." (baseNameOf (toString wallpaper)))}" # WallpaperAgent only keeps choices whose file lives in the user's own space
mkdir -p "/Library/Desktop Pictures"; cp "$V/wallpaper".* "$W"; chmod 644 "$W" # ("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" 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" 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 # the wallpaper store (~/Library/Application Support/com.apple.wallpaper) is
sleep 15 # 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)" echo "vmix: wallpaper now: $(as_user /usr/local/bin/desktoppr 2>/dev/null)"
''} ''}
${lib.optionalString (dockApps != null) '' ${lib.optionalString (dockApps != null) ''