fix: high-quality sampling for downscaled app icons - #832
Open
xav-ie wants to merge 1 commit into
Open
Conversation
The bar context uses kCGInterpolationNone so pixel-exact PNG icons stay crisp, but app icons come from NSImage at native size and get scaled down, so nearest-neighbour sampling leaves them jagged. Draw the scaled sources (app icons, space previews, media artwork) with kCGInterpolationHigh.
xav-ie
marked this pull request as ready for review
July 3, 2026 02:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
App icons in the bar (
icon.background.image=app.<bundle-id>) render withvisible jagged/aliased edges instead of a clean downscaled icon.
The bar's window context is created with
kCGInterpolationNone(window.c),which is the right default for the bar's pixel-exact PNG/alias icons — they are
drawn 1:1 and stay crisp. App icons are the exception:
workspace_icon_for_appreturns the app's
NSImageat its native representation size (often 128px+),which then gets scaled down to the item's icon size at draw time. Downscaling
with nearest-neighbour sampling decimates the image, producing the aliasing.
Fix
In
image_draw, sample only the sources that are genuinely rescaled — appicons, space previews, and linked media artwork — with
kCGInterpolationHighfor the
CGContextDrawImagecall, then restorekCGInterpolationNone.File-backed image icons and text are unaffected: they draw 1:1 or ignore
interpolation quality entirely, so they stay pixel-crisp as before.
Notes
image->pathfor theapp./space.prefixes (plus theimage->linkmedia-artwork case), so the crisp default is preserved foreverything else.
Testing
Before/after screenshots of a
front_app-style item showing the app icon:beforeafter_