diff --git a/packaging/macos/dmg/DS_Store b/packaging/macos/dmg/DS_Store new file mode 100644 index 00000000..eb1189b7 Binary files /dev/null and b/packaging/macos/dmg/DS_Store differ diff --git a/packaging/macos/dmg/README.md b/packaging/macos/dmg/README.md new file mode 100644 index 00000000..38017c9a --- /dev/null +++ b/packaging/macos/dmg/README.md @@ -0,0 +1,47 @@ +# macOS DMG window + +What Finder shows when the DMG opens: a 660 × 400 pt background with the app icon and the +`Applications` link side by side. `package.sh` copies these files into the image; nothing here is +generated at build time, so the DMG still builds with `hdiutil makehybrid` (no mounted device, no +Finder scripting on CI). + +| File | What | +|---|---| +| `background.svg` | Source of the background: the app icon's figure on the VectorCraft colour field (`#e8573f`), Ink and Paper, Inter and JetBrains Mono. | +| `background.tiff` | The background at 1x (660 × 400 px, 72 dpi) and 2x (1320 × 800 px, 144 dpi) in one HiDPI TIFF. Goes to `.background/background.tiff`. | +| `DS_Store` | Finder's view settings for the volume: window size, icon size 128, VectorCraft.app at (326, 205), `Applications` at (574, 205), and the background. Goes to `.DS_Store`. | + +## Rules + +- **The volume name has no version** (`VectorCraft`, not `VectorCraft `). `.DS_Store` points at the + background through an alias that includes the volume name, so a versioned name loses the + background. The DMG file name still carries the version. +- **Finder draws the icon labels in black in light and dark mode** when a window has a background, + so the area under both icons stays light (Paper). +- **Nothing goes inside the icon boxes:** artwork keeps 10 pt clear of each 128 pt icon box and of + the label strip under it. + +## Regenerate + +1. Edit `background.svg` and render it with [resvg](https://github.com/linebender/resvg), with + Inter and JetBrains Mono available (`--use-fonts-dir` pointing at a craft-fonts checkout): + + ```sh + resvg --use-fonts-dir ../craft-fonts -w 660 background.svg bg.png + resvg --use-fonts-dir ../craft-fonts -w 1320 background.svg bg@2x.png + sips -s dpiWidth 144 -s dpiHeight 144 bg@2x.png + tiffutil -cathidpicheck bg.png bg@2x.png -out background.tiff + ``` + +2. `DS_Store` only changes if the window size, icon positions or background file name change. + Recreate it once on a Mac with [create-dmg](https://github.com/create-dmg/create-dmg) and copy it + out of the mounted volume: + + ```sh + create-dmg --volname "VectorCraft" --background background.tiff --window-size 660 432 \ + --icon-size 128 --icon "VectorCraft.app" 326 205 --hide-extension "VectorCraft.app" \ + --app-drop-link 574 205 seed.dmg + hdiutil attach seed.dmg -mountpoint /tmp/seed && cp "/tmp/seed/.DS_Store" DS_Store + ``` + + (660 × 432 includes Finder's 32 pt title bar; the content area is 660 × 400.) diff --git a/packaging/macos/dmg/background.svg b/packaging/macos/dmg/background.svg new file mode 100644 index 00000000..d5444964 --- /dev/null +++ b/packaging/macos/dmg/background.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + +VectorCraft + + +Path · 2 anchors · 2 pt stroke + + +DRAG ONTO APPLICATIONS TO INSTALL + + diff --git a/packaging/macos/dmg/background.tiff b/packaging/macos/dmg/background.tiff new file mode 100644 index 00000000..13e76c6e Binary files /dev/null and b/packaging/macos/dmg/background.tiff differ diff --git a/packaging/macos/package.sh b/packaging/macos/package.sh index 65356490..6c266bdd 100755 --- a/packaging/macos/package.sh +++ b/packaging/macos/package.sh @@ -131,10 +131,15 @@ STAGE="$WORK/dmg" mkdir -p "$STAGE" ditto "$APP" "$STAGE/VectorCraft.app" ln -s /Applications "$STAGE/Applications" +# Finder window layout: background, icon size and positions (packaging/macos/dmg/README.md). +mkdir -p "$STAGE/.background" +cp "$HERE/dmg/background.tiff" "$STAGE/.background/background.tiff" +cp "$HERE/dmg/DS_Store" "$STAGE/.DS_Store" rm -f "$DMG" "$WORK/raw.dmg" # makehybrid + convert builds the image without attaching a device, unlike `create -srcfolder`, # which is flaky on CI runners ("Resource busy") and hangs in sandboxed sessions. -hdiutil makehybrid -hfs -hfs-volume-name "VectorCraft $VERSION" -hfs-openfolder "$STAGE" -o "$WORK/raw.dmg" "$STAGE" +# The volume name has no version: .DS_Store finds the background through an alias that includes it. +hdiutil makehybrid -hfs -hfs-volume-name "VectorCraft" -hfs-openfolder "$STAGE" -o "$WORK/raw.dmg" "$STAGE" hdiutil convert "$WORK/raw.dmg" -format UDZO -imagekey zlib-level=9 -o "$DMG" rm -f "$WORK/raw.dmg" sign "$DMG"