Skip to content

Ship the Dock a full-size icon on the first launch after an update - #167

Merged
dayglojesus merged 1 commit into
mainfrom
fix/dock-icon-full-size
Oct 27, 2026
Merged

dayglojesus merged 1 commit into
mainfrom
fix/dock-icon-full-size

Conversation

@dayglojesus

Copy link
Copy Markdown
Collaborator

Summary

After an in-app update (seen going 2.6.0 → 2.6.1), the TextMate tile in the ⌘Tab app switcher is pixelated until the app is launched a second time.

The first-launch refresh added in 2.5.1 (#121, now RefreshDockIconIfUpdated in AppController.mm) sets NSApp.applicationIconImage to [NSWorkspace iconForFile:bundlePath] so the Dock drops its stale tile. Two facts combine badly:

  • Icon Services returns the icon with a nominal size of 32×32 points, carrying representations up to 2048 pixels.
  • AppKit rasterises applicationIconImage at the image's nominal size. A probe whose drawing handler reports the device rect it is asked to fill gives 64, 256 and 2048 pixels for nominal sizes of 32, 128 and 1024 points.

So the refresh hands the Dock a 64×64 pixel bitmap, and the switcher's ~128 point tiles stretch it four times. The next launch skips the refresh (same version) and the bundle icon is used at full size, which is why a restart "fixes" it.

Change

  • OakDockIconImageForBundleAtPath() in SoftwareUpdate, beside the version-changed check it serves: the Icon Services image with its size raised to the largest representation.
  • RefreshDockIconIfUpdated uses it.
  • New Frameworks/SoftwareUpdate/tests/t_dock_icon.mm: the helper's image has a representation of at least 512 points and the image size equals the largest one. It failed to build before the helper existed; the suite passes 35 of 35.

Verification

Debug build of this branch, with defaults write com.macromates.TextMate lastLaunchedVersion 0.0 so the refresh fires on launch: the ⌘Tab tile is sharp. The same recipe on a build of main reproduces the pixelated tile.

Changelog

Software Update: The Dock and ⌘Tab icon is no longer blurry on the first launch after an update.

The first-launch refresh from 2.5.1 sets NSApp.applicationIconImage to
the Icon Services image for the bundle. Icon Services returns app icons
at a nominal 32×32 points, and AppKit rasterises the application icon
at the image’s nominal size, so the Dock received a 64×64 pixel bitmap.
The ⌘Tab switcher draws tiles at about 128 points and showed it
stretched until the next launch, when the refresh is skipped and the
bundle icon is used at full size again.

OakDockIconImageForBundleAtPath() raises the image’s size to its largest
representation before it is handed over, so the bitmap is 2048 pixels.
Measured with a drawing-handler probe: nominal 32, 128 and 1024 points
rasterise at 64, 256 and 2048 pixels.
@dayglojesus
dayglojesus merged commit 3ef8ec1 into main Oct 27, 2026
3 checks passed
@dayglojesus
dayglojesus deleted the fix/dock-icon-full-size branch October 27, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant