fix(icons): stop macOS drawing the app icon on a legacy plate (#40)
On macOS 26+ the Dock and any launcher that resolves app icons through
NSWorkspace.icon(forFile:) (Spotlight, Vicinae, Raycast, ...) drew a grey
rounded-square "legacy plate" behind Gridline's icon, i.e. a white border
around the app icon at every render size below ~72px.
Reproduced outside any launcher: NSWorkspace.icon(forFile:) on
Gridline.app returns the plated icon at 16-64px and the clean icon at
>=72px. The trigger lives in icon.icns, not in the app -- moving that file
into Zed.app reproduces the border, moving Zed's icns into Gridline.app
removes it.
Two things in the file cause it:
- ic12 (64x64) -> plates the 40-64px range
- is32/s8mk (16x16 RGB+mask)
il32/l8mk (32x32 RGB+mask) -> plates the 16-32px range
macOS treats padded small representations as legacy, and this icns carries
them in both places.
Fix, in two parts.
1. Strip those chunks. scripts/fix-icns.mjs does it; `tauri icon` re-emits
them on every run, so it has to be a committed, repeatable step.
scripts/verify-app-icon.mjs is the regression check: it builds a
throwaway .app around the committed icon.icns, asks AppKit to render it
at 16..512px and fails if any size comes back plated. It fails (6/11
plated) on the previous icns and passes on this one.
2. Regenerate the raster set from icon.svg via
scripts/regenerate-icons.sh, so the icons directory matches its source
of truth again. The SVG has been full-bleed since the initial commit
(md5 unchanged at d872e42/3dab09f/6854d88/HEAD) while the rasters were
replaced with a hand-tuned padded version at v0.2.0 and had drifted
from it ever since. The script generates into a temp dir because
`tauri icon` only takes one output directory and would otherwise drop
generated android/ and ios/ trees into the desktop-only icons dir.
No visual change on macOS: IconServices normalizes app-icon artwork when
rendering, so padded and full-bleed sets come out pixel-identical there
(same bbox and art fraction at 48/128/512px).
Windows and Linux do consume the PNG/ICO directly, so the icon there does
change from padded to full-bleed -- consistent with the SVG, but a
visible difference worth eyeballing before release.
Verified: verify-app-icon passes at 16, 24, 32, 40, 48, 64, 72, 96, 128,
256, 512px; iconutil and `file` still decode the new .icns and .ico
(6 sizes); frontend tests pass (131 files / 1134 tests).
This commit is contained in:
@@ -161,10 +161,30 @@ bun run --filter gridline-desktop build # Desktop production build
|
||||
bun run dev:www # Website dev server (Astro)
|
||||
bun run build:www # Website static build (www/dist/)
|
||||
bun run test # Desktop frontend tests (vitest)
|
||||
bun run icons # Regenerate desktop/src-tauri/icons/* from icon.svg
|
||||
bun run icons:verify # Check the macOS icon isn't rendered on a legacy plate
|
||||
cargo build # Rust backend only (from desktop/src-tauri/)
|
||||
cargo test # Rust tests (from desktop/src-tauri/)
|
||||
```
|
||||
|
||||
### App icon
|
||||
|
||||
`desktop/src-tauri/icons/icon.svg` is the source of truth; every PNG/ICNS/ICO beside it is generated output.
|
||||
|
||||
Regenerate **only** through the script — never with a bare `tauri icon`:
|
||||
|
||||
```bash
|
||||
bun run icons # tauri icon -> temp dir, copy back the desktop set, then fix the ICNS
|
||||
bun run icons:verify # asserts AppKit renders the icon cleanly at 16px..512px
|
||||
```
|
||||
|
||||
Two reasons the wrapper is mandatory:
|
||||
|
||||
1. `tauri icon` takes one output directory for all platforms, so running it in place would drop generated `android/` and `ios/` trees into the desktop-only icons directory. The script generates into a temp dir and copies back just the desktop files.
|
||||
2. `tauri icon` emits legacy `is32`/`s8mk`/`il32`/`l8mk` (+ `ic12`) representations. **macOS 26+ then draws a grey "legacy plate" behind the icon for every render size below ~72px** — a white border around the app icon in the Dock and in any launcher that resolves icons via `NSWorkspace.icon(forFile:)` (Spotlight, Vicinae, Raycast). `scripts/fix-icns.mjs` strips those chunks, which makes the icon render cleanly at every size.
|
||||
|
||||
`scripts/verify-app-icon.mjs` is the regression check for that: it builds a throwaway `.app` around the committed `icon.icns`, asks AppKit for the icon (the same call launchers make) and fails if any size comes back plated. Run it after touching icons, and after bumping Tauri (a newer `tauri icon` may change what it emits).
|
||||
|
||||
### Branch & PR workflow
|
||||
|
||||
**GitHub is the only remote that matters.** The canonical repo is `github` → [AdrianBonpin/gridline](https://github.com/AdrianBonpin/gridline) (default branch `prod`, issues, PRs, Actions, releases). The `origin` remote (`git.ranio.xyz/adrianbonpin/gridline`) is a **just-in-case mirror** — do not push branches, open PRs, or publish releases/tags there. If you must mirror something manually, push to `github` first.
|
||||
|
||||
Reference in New Issue
Block a user