diff --git a/browse/src/browser-manager.ts b/browse/src/browser-manager.ts index 88789c29..ef476248 100644 --- a/browse/src/browser-manager.ts +++ b/browse/src/browser-manager.ts @@ -277,6 +277,21 @@ export class BrowserManager { .replace(/Google Chrome for Testing/g, 'GStack Browser'); fs.writeFileSync(chromePlist, patched); } + // Replace Chromium's Dock icon with ours (Chromium's process owns the Dock icon) + const iconCandidates = [ + path.join(__dirname, '..', '..', 'scripts', 'app', 'icon.icns'), // repo dev mode + path.join(process.env.HOME || '', '.claude', 'skills', 'gstack', 'scripts', 'app', 'icon.icns'), // global install + ]; + const iconSrc = iconCandidates.find(p => fs.existsSync(p)); + if (iconSrc) { + const chromeResources = path.join(chromeContentsDir, 'Resources'); + // Read original icon name from plist + const iconMatch = plistContent.match(/CFBundleIconFile<\/key>\s*([^<]+)<\/string>/); + let origIcon = iconMatch ? iconMatch[1] : 'app'; + if (!origIcon.endsWith('.icns')) origIcon += '.icns'; + const destIcon = path.join(chromeResources, origIcon); + try { fs.copyFileSync(iconSrc, destIcon); } catch { /* non-fatal */ } + } } } catch { // Non-fatal: app name just stays as Chrome for Testing diff --git a/scripts/app/icon.icns b/scripts/app/icon.icns new file mode 100644 index 00000000..e11555db Binary files /dev/null and b/scripts/app/icon.icns differ diff --git a/scripts/build-app.sh b/scripts/build-app.sh index 2dc28740..1c7b0c30 100755 --- a/scripts/build-app.sh +++ b/scripts/build-app.sh @@ -96,6 +96,27 @@ if [ -f "$CHROMIUM_PLIST" ]; then plutil -convert xml1 "$CHROMIUM_STRINGS" 2>/dev/null || true sed -i '' "s/Google Chrome for Testing/$APP_NAME/g" "$CHROMIUM_STRINGS" 2>/dev/null || true fi + # Replace Chromium's icon with ours so the Dock shows the GStack icon + # (Chromium's process owns the Dock icon, not our launcher) + ICON_SRC="$SCRIPT_DIR/app/icon.icns" + if [ -f "$ICON_SRC" ]; then + CHROMIUM_RESOURCES="$APP_DIR/Contents/Resources/chromium/$(basename "$CHROME_APP")/Contents/Resources" + # Find the original icon filename from Chromium's plist + ORIG_ICON=$(/usr/libexec/PlistBuddy -c "Print :CFBundleIconFile" "$CHROMIUM_PLIST" 2>/dev/null || echo "app") + # Add .icns extension if not present + [[ "$ORIG_ICON" != *.icns ]] && ORIG_ICON="${ORIG_ICON}.icns" + cp "$ICON_SRC" "$CHROMIUM_RESOURCES/$ORIG_ICON" + echo " Replaced Chromium icon → $ORIG_ICON" + fi +fi + +# ─── Step 3c: App icon ──────────────────────────────────────────── +ICON_SRC="$SCRIPT_DIR/app/icon.icns" +if [ -f "$ICON_SRC" ]; then + cp "$ICON_SRC" "$APP_DIR/Contents/Resources/icon.icns" + echo " App icon installed" +else + echo " WARNING: No icon.icns found at $ICON_SRC — app will use default icon" fi # ─── Step 4: Info.plist ──────────────────────────────────────────