From 3fe15c0650a9d5786810e3bb76fab72b0941c547 Mon Sep 17 00:00:00 2001 From: wgqqqqq Date: Mon, 7 Sep 2026 10:08:40 +0800 Subject: [PATCH 1/2] fix(desktop): match DMG background resolution to Finder layout --- scripts/desktop-tauri-build.test.mjs | 25 +++++++++++++++++++++++++ src/apps/desktop/AGENTS.md | 6 ++++++ src/apps/desktop/dmg/background.png | Bin 358395 -> 358395 bytes 3 files changed, 31 insertions(+) diff --git a/scripts/desktop-tauri-build.test.mjs b/scripts/desktop-tauri-build.test.mjs index 40037fa28d..2399ecc306 100644 --- a/scripts/desktop-tauri-build.test.mjs +++ b/scripts/desktop-tauri-build.test.mjs @@ -68,6 +68,31 @@ test('Desktop DMG uses the branded installer layout', () => { appPosition: { x: 180, y: 170 }, applicationFolderPosition: { x: 480, y: 170 }, }); + + // Finder uses the PNG's physical size, not just its pixel dimensions. + // A 660x400 image tagged at 96 DPI renders at 495x300 points and leaves gaps. + const dmg = config.bundle.macOS.dmg; + const background = readFileSync(join(ROOT, 'src', 'apps', 'desktop', dmg.background)); + assert.deepEqual(background.subarray(0, 8), Buffer.from('89504e470d0a1a0a', 'hex')); + let pixels; + let density; + for (let offset = 8; offset < background.length; ) { + const length = background.readUInt32BE(offset); + const type = background.toString('ascii', offset + 4, offset + 8); + if (type === 'IHDR') { + pixels = [background.readUInt32BE(offset + 8), background.readUInt32BE(offset + 12)]; + } else if (type === 'pHYs') { + assert.equal(background[offset + 16], 1, 'background density must be in pixels per metre'); + density = [background.readUInt32BE(offset + 8), background.readUInt32BE(offset + 12)]; + } + offset += length + 12; + } + assert.ok(pixels && density, 'DMG background must declare pixel dimensions and physical density'); + for (const [axis, points] of [dmg.windowSize.width, dmg.windowSize.height].entries()) { + const imagePoints = pixels[axis] * 72 / (density[axis] * 0.0254); + // PNG stores integer pixels/metre, so 72 DPI rounds to 2835 pixels/metre. + assert.ok(Math.abs(imagePoints - points) < 0.1, `background axis ${axis} must match Finder points`); + } }); test('Desktop builds prepare and bundle the OpenCode extension Host', () => { diff --git a/src/apps/desktop/AGENTS.md b/src/apps/desktop/AGENTS.md index 187f2ca93a..5ce7a2bff8 100644 --- a/src/apps/desktop/AGENTS.md +++ b/src/apps/desktop/AGENTS.md @@ -89,6 +89,12 @@ The `devtools` Cargo feature exists for debugging UI/UX in the desktop app. When ## Verification +For DMG background metadata and installer layout, run +`node --test scripts/desktop-tauri-build.test.mjs` from the repository root. +Finder interprets the background's physical size: keep the 660×400 PNG at +72 DPI so it matches the configured window in points. Pixel dimensions alone +do not guarantee a matching layout. + ```bash cargo check -p openbitfun-desktop && cargo test -p openbitfun-desktop ``` diff --git a/src/apps/desktop/dmg/background.png b/src/apps/desktop/dmg/background.png index 6e5f604d9b2f6c3a8347631528e8777198c615d1..a48af7a1450c721a0cd2a75bff56e89b0286bd18 100644 GIT binary patch delta 39 vcmezUUi9~S(Fq>h+`he1{nr_zp83&tH+!7~C4n*c!~#8qC}p%(69@bwxP Date: Mon, 7 Sep 2026 10:13:12 +0800 Subject: [PATCH 2/2] chore: remove DMG guidance from desktop agent instructions --- src/apps/desktop/AGENTS.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/apps/desktop/AGENTS.md b/src/apps/desktop/AGENTS.md index 5ce7a2bff8..187f2ca93a 100644 --- a/src/apps/desktop/AGENTS.md +++ b/src/apps/desktop/AGENTS.md @@ -89,12 +89,6 @@ The `devtools` Cargo feature exists for debugging UI/UX in the desktop app. When ## Verification -For DMG background metadata and installer layout, run -`node --test scripts/desktop-tauri-build.test.mjs` from the repository root. -Finder interprets the background's physical size: keep the 660×400 PNG at -72 DPI so it matches the configured window in points. Pixel dimensions alone -do not guarantee a matching layout. - ```bash cargo check -p openbitfun-desktop && cargo test -p openbitfun-desktop ```