Skip to content

feat(desktop): add a custom macOS DMG background - #61428

Open
opencode-agent[bot] wants to merge 1 commit into
devfrom
desktop-dmg-background
Open

opencode-agent[bot] wants to merge 1 commit into
devfrom
desktop-dmg-background

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

The macOS DMG now opens to a branded window instead of Finder's default: a light background with the wordmark and a drag arrow, the app on the left, Applications on the right, and the channel icon as the volume icon.

How

Since #59046, sign-desktop-macos.sh has built the DMG with a bare hdiutil create, so no electron-builder dmg settings applied to released images, including the prod dmg.icon. A Finder layout needs a .DS_Store written by dmgbuild, which the sign job shouldn't run. The work is now split between the two jobs:

  • Build job (pack.ts): After --dir, electron-builder packs the dmg target around an empty <name>.app folder as opencode-desktop-mac-<arch>.layout.dmg. The image is 2 GB and not shrunk, so the app fits later. The layout is a few hundred KB.
  • Sign job (sign-desktop-macos.sh): After stapling, it converts the layout to read-write, mounts it with -nobrowse, and checks that only Applications (linked to /Applications) and the empty app folder are visible. It then dittos the stapled app into place, shrinks the image to its minimum size and converts it to UDZO at the same zlib levels as before. Only hdiutil and ditto run there.
  • Workflows and publish scripts: No changes. The layout travels in the existing build-desktop-darwin-* artifact, and the DMG name and location are unchanged.

Layout

  • Window: 660×400 pt. App icon at (180, 210), Applications at (480, 210), icon size 128.
  • Volume name: ${productName}, the same as before (OpenCode, OpenCode Beta, OpenCode Dev).
  • Background: icons/dmg/background.png plus @2x. electron-builder combines them into a HiDPI TIFF.
  • Light background: Finder always draws icon labels in black once a background picture is set, including in Dark Mode.
  • The prod dmg override now spreads the shared layout instead of replacing it. The config test covers this.

The background art is a placeholder until design signs off.

Verification

  • bun test electron-builder.config.test.ts passes. It fails if the prod override drops the layout.
  • bun typecheck and bun run lint:changed are clean.
  • shellcheck reports nothing new in sign-desktop-macos.sh.
  • The release-dry-run workflow on this PR builds both layouts and runs the sign script with ad-hoc signing.

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72" fill="none">
  <style>
    .dot{animation:m 2.4s ease-in-out infinite}
    @keyframes m{0%{transform:translateX(0);opacity:0}15%{opacity:1}70%{transform:translateX(70px);opacity:1}85%,100%{transform:translateX(70px);opacity:0}}
    @media (prefers-reduced-motion:reduce){.dot{animation:none;opacity:0}}
  </style>
  <rect x="38" y="14" width="44" height="44" rx="10" fill="currentColor" opacity=".8"/>
  <rect x="53" y="24" width="14" height="24" stroke="currentColor" stroke-width="3" opacity=".35"/>
  <path d="M98 36h40" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-dasharray=".1 7" opacity=".45"/>
  <path d="M137 29l7 7-7 7" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" opacity=".6"/>
  <path d="M160 20h15l4 5h23v31h-42z" fill="currentColor" opacity=".35"/>
  <circle class="dot" cx="90" cy="36" r="4" fill="currentColor"/>
</svg>

Requested by: @Brendonovich (Brendan via Slack)

The build job packs the disk image layout (background, icon positions and
volume icon) around an empty app folder, and sign-desktop-macos.sh puts the
stapled app in its place instead of making a plain hdiutil image.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks sound, but I couldn't verify it here: building the layout and putting the app into it both need macOS (electron-builder's dmg target, hdiutil, ditto). The config test passes and tsc -b is clean. I also read electron-builder 26.15.7 to check the packing step: with --prepackaged pointing at the empty placeholder .app, it uses that folder as the app, doesn't sign the dmg, and keeps the opencode-desktop-mac-<arch>.dmg name that pack.ts copies. The layout image travels only in build-desktop-darwin-*, which publish-github-release.sh doesn't download, so it won't end up attached to releases. Before merging, please confirm that the release-dry-run sign step produced a DMG that opens to the new layout (a screenshot of the mounted window would help).

Public API: unchanged. These are only build and release internals; the DMG names and locations stay the same.

No blocking concerns.

@Brendonovich
Brendonovich enabled auto-merge (squash) November 3, 2026 16:52

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant