Files
raea/tools/release/dmg/layout.applescript
shinyobjectz 37652ae571 dmg: raea's Mac installer window, drawn by raea
tools/release/dmg makes the Mac download as a disk image: raea.app beside an Applications link in a Finder window
laid out over raea's own picture. background.tsx is one WGSL shader (ShaderMesh) rendered by raea: paper, a pixel
falloff Bayer-dithered into the corners, the cat leaping from the app toward Applications as dithered onion skins,
the rest of its arc as dots with a pixel arrowhead, and a second cat asleep in the corner. render.sh renders it at
1x and 2x into one multi-resolution TIFF (tiffutil -cathidpicheck), committed as background.tiff; --loop renders
the same scene moving (the leap, 3 s at 60 fps), since Finder only ever shows a window's picture still.

dmg.sh APP OUT.dmg [--volname] [--sign ID [--keychain]] [--notarize ENV]: a writable HFS+ image, the app copied in
with ditto, layout.applescript has Finder set the window (680x440 content, icon view, no toolbar, 128 px icons,
the picture, each icon's place) so Finder writes the .DS_Store, then the app's icon as the volume's, then ULFO.
Finder on macOS 27 deletes a .VolumeIcon.icns and clears the custom-icon flag when it opens the volume, so the icon
goes in after the layout. Labels are drawn black over any picture in both appearances, so the window stays light.
check.sh mounts an image read-only and checks its files, the layout's picture and the window Finder reads back.
Built and checked here with a stand-in app; nothing signed or notarized.
2026-11-14 12:09:56 -08:00

50 lines
2.5 KiB
AppleScript

-- The installer window's layout (dmg.sh): Finder opens the mounted volume VOL, hides the toolbar and status bar,
-- sizes the window, sets icon view with the background picture, the icon and text size, and puts the app and the
-- Applications link where the background expects them. Finder keeps all of it in the volume's .DS_Store, which is
-- what a person's Finder reads when they open the disk image. Printed: the window's bounds and each item's position,
-- read back from Finder after it reopens the window.
-- osascript layout.applescript VOL BACKGROUND W H APP APP_X APP_Y APPS_X APPS_Y ICON_PX TEXT_PX
on run argv
set volName to item 1 of argv
set bgName to item 2 of argv
set winW to (item 3 of argv) as integer
set winH to (item 4 of argv) as integer
set appName to item 5 of argv
set appX to (item 6 of argv) as integer
set appY to (item 7 of argv) as integer
set lnX to (item 8 of argv) as integer
set lnY to (item 9 of argv) as integer
set iconPx to (item 10 of argv) as integer
set textPx to (item 11 of argv) as integer
-- a window's bounds include its title bar: 28 points to macOS 15, 32 on 26. The picture is drawn from the content's
-- top left, so 28 shows all of it on the older ones and crops 4 points of plain paper on the newer.
set titleBar to 28
tell application "Finder"
tell disk volName
open
set current view of container window to icon view
set toolbar visible of container window to false
set statusbar visible of container window to false
set the bounds of container window to {160, 120, 160 + winW, 120 + winH + titleBar}
set opts to the icon view options of container window
set arrangement of opts to not arranged
set icon size of opts to iconPx
set text size of opts to textPx
set shows item info of opts to false
set shows icon preview of opts to false
set background picture of opts to file (".background:" & bgName)
set position of item appName of container window to {appX, appY}
set position of item "Applications" of container window to {lnX, lnY}
close
open
update without registering applications
delay 1
set b to bounds of container window
set p1 to position of item appName of container window
set p2 to position of item "Applications" of container window
close
end tell
end tell
return "bounds " & (item 1 of b) & "," & (item 2 of b) & "," & (item 3 of b) & "," & (item 4 of b) & "; " & appName & " " & (item 1 of p1) & "," & (item 2 of p1) & "; Applications " & (item 1 of p2) & "," & (item 2 of p2)
end run