Skip to content

👾 Open Computer Use – Open-Source Alternative to Codex Computer Use

fix: bundle official cursor glyph in release app

Leod021ee4e5246
diff --git a/docs/exec-plans/active/20260418-standalone-cursor-lab.md b/docs/exec-plans/active/20260418-standalone-cursor-lab.md
index b78f924..45804a2 100644
--- a/docs/exec-plans/active/20260418-standalone-cursor-lab.md
+++ b/docs/exec-plans/active/20260418-standalone-cursor-lab.md
@@ -85,6 +85,7 @@
- 2026-04-20:继续修正 panel 在浅背景上的识别度;当前 card fill 已收成更实的灰白底,并加强描边和阴影,减少背景渐变直接透到 panel 上导致的“看起来像不同底色”问题。
- 2026-04-20:已把独立 demo 的对外命名统一收口到 `Cursor Motion` / `CursorMotion`;Swift Package product、实验目录、README 入口和相关文档现在都以 `swift run CursorMotion` 为准,不再保留 `StandaloneCursorLab` 旧名。
- 2026-04-20:已补一条 tag 驱动的 `Cursor Motion` 分发链路;本地可以通过 `scripts/build-cursor-motion-dmg.sh` 构建 DMG,GitHub Actions 在推送 release tag 后会自动生成 `CursorMotion-<version>.dmg` 并上传到 GitHub Releases。
+- 2026-04-20:继续修正“打包版和 `swift run CursorMotion` 观感不一致”的问题;当前已确认 release app 之前没把官方 `252x252` baseline cursor PNG 带进 bundle,导致退回 procedural glyph。现在 `.app` 会优先从 `Bundle.main` 读官方 cursor 图,DMG 打包脚本也会把这张图复制进 `Contents/Resources`,并显式打开 `NSHighResolutionCapable`。
## 决策记录
@@ -101,3 +102,4 @@
- 2026-04-20:对 `SPRING`,当前实验线采用“围绕官方 `.official` 的 centered response/damping remap,而不是再叠加额外 distance-based duration 层”的策略;这更接近当前 binary-backed 证据里“主链直接吃 `1.4 / 0.9` spring config”的边界。
- 2026-04-20:调左上角 slider 时,path 重建现在统一基于当前会话里最近一次 move 的 reference origin / startRotation / `queuedTarget`,而不是外层 `@State start/end` 或 settled 后的 live endpoint;这样参数调节既不会把曲线起点误拉回初始位置,也不会把 DEBUG 反馈线消成零长度。
- 2026-04-20:对 `Cursor Motion` 的对外交付,当前采用“源码运行 + GitHub Releases 分发 ad-hoc signed DMG”的策略;先把 tag 驱动的可复现封装链路稳定下来,不在这一轮提前引入 notarization 和 Developer ID 签名复杂度。
+- 2026-04-20:对 packaged `Cursor Motion` 的 glyph 资源,当前采用“bundle 内官方 baseline 图优先,仓库 reference 路径兜底”的策略;这样 release app 不再因为缺资源而静默退回低保真的 procedural glyph。
diff --git a/docs/histories/2026-04/20260418-1430-standalone-cursor-lab.md b/docs/histories/2026-04/20260418-1430-standalone-cursor-lab.md
index 3a4bc8a..d475a79 100644
--- a/docs/histories/2026-04/20260418-1430-standalone-cursor-lab.md
+++ b/docs/histories/2026-04/20260418-1430-standalone-cursor-lab.md
@@ -380,3 +380,16 @@
- `docs/exec-plans/active/20260418-standalone-cursor-lab.md`
- `docs/releases/RELEASE_GUIDE.md`
- `scripts/build-cursor-motion-dmg.sh`
+
+### 🔁 Follow-up (2026-04-20, make packaged Cursor Motion match swift-run glyph quality)
+**Scope:** `experiments/CursorMotion/`、`scripts/`
+
+**Key Actions:**
+- **[定位到 release app 资源缺失]**: 重新检查后确认 `swift run CursorMotion` 和 DMG 版观感不一致,不是 motion 算法分叉,而是打包 `.app` 时没有把官方 `official-software-cursor-window-252.png` 一起带进去;release app 因此退回 procedural glyph,肉眼就会出现更锯齿、朝向也不如官方 baseline 准的结果。
+- **[补 bundle 内资源加载]**: `SynthesizedCursorGlyphView` 现在会优先从 `Bundle.main` 读取打进 `.app` 的官方 cursor PNG,只在开发态或 bundle 资源缺失时才回退到仓库里的 reference 路径。
+- **[补 DMG 打包资源与高分屏标记]**: `build-cursor-motion-dmg.sh` 现在会把官方 cursor PNG 复制到 `Cursor Motion.app/Contents/Resources/`,并在 `Info.plist` 里显式写入 `NSHighResolutionCapable=true`,避免继续静默产出低保真 app。
+- **[补本地验证]**: 已本地重打 `./scripts/build-cursor-motion-dmg.sh --configuration release --arch native --version 0.1.13-glyphfix`,并确认 `.app` 内的 PNG 与仓库参考图 SHA256 一致。
+
+### 📁 Additional Files Modified
+- `experiments/CursorMotion/Sources/CursorMotion/SynthesizedCursorGlyphView.swift`
+- `scripts/build-cursor-motion-dmg.sh`
diff --git a/experiments/CursorMotion/Sources/CursorMotion/SynthesizedCursorGlyphView.swift b/experiments/CursorMotion/Sources/CursorMotion/SynthesizedCursorGlyphView.swift
index 3c5b766..f2f85a1 100644
--- a/experiments/CursorMotion/Sources/CursorMotion/SynthesizedCursorGlyphView.swift
+++ b/experiments/CursorMotion/Sources/CursorMotion/SynthesizedCursorGlyphView.swift
@@ -236,6 +236,13 @@ final class SynthesizedCursorGlyphView: NSView {
}
private func loadReferenceCursorWindowImage() -> NSImage? {
+ if let bundledReference = Bundle.main.url(
+ forResource: "official-software-cursor-window-252",
+ withExtension: "png"
+ ), let image = NSImage(contentsOf: bundledReference) {
+ return image
+ }
+
let fileURL = URL(fileURLWithPath: #filePath).standardizedFileURL
let repoRoot = fileURL
.deletingLastPathComponent()
diff --git a/scripts/build-cursor-motion-dmg.sh b/scripts/build-cursor-motion-dmg.sh
index 450824e..f735aff 100755
--- a/scripts/build-cursor-motion-dmg.sh
+++ b/scripts/build-cursor-motion-dmg.sh
@@ -108,14 +108,16 @@ build_binary() {
app_name="Cursor Motion.app"
bundle_identifier="com.ifuryst.cursormotion"
bundle_version="${CURSOR_MOTION_BUNDLE_VERSION:-${GITHUB_RUN_NUMBER:-$(git -C "${repo_root}" rev-list --count HEAD 2>/dev/null || echo 1)}}"
+cursor_reference_source="${repo_root}/docs/references/codex-computer-use-reverse-engineering/assets/extracted-2026-04-19/official-software-cursor-window-252.png"
app_root="${output_dir}/${app_name}"
contents_dir="${app_root}/Contents"
macos_dir="${contents_dir}/MacOS"
+resources_dir="${contents_dir}/Resources"
dmg_root="${output_dir}/dmg-root"
dmg_path="${output_dir}/CursorMotion-${version}.dmg"
rm -rf "${output_dir}"
-mkdir -p "${macos_dir}" "${dmg_root}"
+mkdir -p "${macos_dir}" "${resources_dir}" "${dmg_root}"
cd "${repo_root}"
@@ -138,6 +140,13 @@ esac
chmod +x "${macos_dir}/CursorMotion"
+if [[ ! -f "${cursor_reference_source}" ]]; then
+ echo "Missing cursor reference asset: ${cursor_reference_source}" >&2
+ exit 1
+fi
+
+cp "${cursor_reference_source}" "${resources_dir}/official-software-cursor-window-252.png"
+
cat > "${contents_dir}/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@@ -163,6 +172,8 @@ cat > "${contents_dir}/Info.plist" <<PLIST
<string>${bundle_version}</string>
<key>LSMinimumSystemVersion</key>
<string>14.0</string>
+ <key>NSHighResolutionCapable</key>
+ <true/>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>