make systray icon look ok on retina display
systray lib appears to hard code the size of the icon at 16x16:
https://github.com/getlantern/systray/blob/master/systray_darwin.m#L162
- the resolution of the display is called
backingScaleFactor
. here is some code for how to query it. https://stackoverflow.com/questions/11067066/mac-os-x-best-way-to-do-runtime-check-for-retina-display - but, it seems like you are not supposed to do this. instead, you are supposed to build multi-resolution images.
- somehow, if you have multiple resolutions in the image data, you can give them names like 'icon' and 'icon@2x' and it will know to pick the right one.
- mac website says this "Toolbar graphics are not icons. Don’t use iconutil to package them. Instead, use tiffutil"
I am not sure how to build multi resolution images. I saw these instructions:
- Create two PNG images sized 16x16 and 32x32 or, if you want less margin, 18x18 and 36x36 pixels
- Create a new image asset in Xcode with Render As set to Template Image and add your images for 1x and 2x
- Initialize your NSImage from the image asset without changing its size: NSImage(named: "Example")
I have also seen this suggestion:
tiffutil -cathidpicheck tray_icon.png tray_icon@2x.png -out tray_icon.tiff
getlantern/systray does this to create the image:
NSImage *image = [[NSImage alloc] initWithData:buffer];
From what I can tell, buffer can be raw TIFF data.
Here is a useful page on high resolution image guidelines:
i have a mac with a retina display for another week. i can help try it out, if someone helps me build on mac.