Repository navigation
feat(tray): mark dev-instance tray icons with a DEV indicator - #9253
Conversation
Dev builds reuse the production template glyph in the macOS menu bar, so a dev status item was indistinguishable from the installed app's. Show a 'DEV' title next to the glyph on macOS, carry the dev worktree/branch label in the tooltip on both macOS and Windows, and add a disabled menu header identifying the instance so side-by-side dev trays can be told apart. Co-authored-by: Orca <[email protected]>
📝 WalkthroughWalkthroughDevelopment-instance metadata now flows into the system tray. Development trays display DEV-aware tooltips and menu indicators, while macOS applies a DEV badge to the template icon and preserves the indicator during attention updates. Windows uses the tooltip without macOS-specific behavior. Production trays remain unchanged. Tray tests cover these behaviors, and localized waiting-state suffix keys were added across supported locales. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The setTitle('DEV') text widened the status item beyond the production
footprint. Stamp a 5px pixel-caps DEV badge into the menu-bar template
instead: same item size, template-tinted for both menu-bar themes, and
inherited by the attention tint path. A cleared margin keeps the orca
tail's antialiased pixels from closing the V into a U.
Co-authored-by: Orca <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/tray/tray-dev-badge.ts (1)
34-38: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winOptimize bounding box clearing by using row-level fills.
Calling
bitmap.fill()for every single pixel introduces unnecessary function-call overhead. Since the pixels in each row are contiguous in memory, you can clear each row segment in a singlefill()call.♻️ Proposed refactor
- for (let y = Math.max(0, clearTop); y < Math.min(pixelHeight, clearBottom); y++) { - for (let x = Math.max(0, clearLeft); x < Math.min(pixelWidth, clearRight); x++) { - bitmap.fill(0x00, (y * pixelWidth + x) * 4, (y * pixelWidth + x) * 4 + 4) - } - } + const startX = Math.max(0, clearLeft) + const endX = Math.min(pixelWidth, clearRight) + if (startX < endX) { + for (let y = Math.max(0, clearTop); y < Math.min(pixelHeight, clearBottom); y++) { + bitmap.fill(0x00, (y * pixelWidth + startX) * 4, (y * pixelWidth + endX) * 4) + } + }
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 05f58652-254e-4613-a9f5-03fd6aa2f4b9
📒 Files selected for processing (4)
src/main/tray/system-tray.test.tssrc/main/tray/system-tray.tssrc/main/tray/tray-dev-badge.test.tssrc/main/tray/tray-dev-badge.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/tray/system-tray.ts
- src/main/tray/system-tray.test.ts
…ai#9253) Co-authored-by: Orca <[email protected]>
Summary
Dev builds reuse the production template glyph in the macOS menu bar, so a dev instance's status item was indistinguishable from the installed app's. This adds a DEV indicator to the system tray without changing the status item's size:
DEVbadge is stamped directly into the menu-bar template bitmap (tray-dev-badge.ts), in the empty area left of the orca glyph — the status item keeps the exact production footprint. Badge pixels are template black, so macOS tints them correctly in both light and dark menu bars, and the attention (amber dot) tint path inherits the badge for free since it reads the same pixels. A one-pixel cleared margin keeps the orca tail's antialiased pixels from bleeding into theV. The @2x Retina representation is rebuilt with the badge so it stays sharp.Orca DEV (<worktree/branch label>), using the samegetDevInstanceIdentitylabel that already feeds the window title and Dock, so multiple side-by-side dev instances (one per worktree) can be told apart by hover.isDev: falseshort-circuits to the previous image and strings), and a badge-stamping failure degrades to the plain icon instead of aborting tray creation.New
tray.activityWaitingSuffixkey synced across all locale catalogs viapnpm run sync:localization-catalog.Screenshots
Menu bar — dev instance (left, with DEV badge) next to the production Orca icon (right), same footprint:
Pixel zoom (nearest-neighbor 8x) of the badged icon vs the production icon:
Tray menu with the instance-identifying header:
Testing
tray-dev-badge.test.ts: badge keeps the template canvas size, stamps only opaque template-black pixels, empty-image no-op, and the @2x stamp covers exactly 4x the 1x area.system-tray.test.ts: dev badge stamped with rebuilt Retina rep +setTemplateImage(true), attention tints the badged image, stamping failure falls back to the plain icon, tooltip/menu header with and without label, attention-toggle tooltip persistence, Windows tooltip, production no-op. 32/32 tray tests pass.pnpm run typecheckclean.run-electron-vite-dev.mjs, screenshotted the real menu bar, and pixel-zoomed the result. First attempt usedtray.setTitle('DEV')(rejected: widens the item); the first in-icon placement collided with the orca tail's antialiasing and read "DEU" — fixed by shifting the badge up one row and clearing a margin. Final screenshots above show the corrected badge at production width.