Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finder file icon badging (icon overlay) on Mac OS X >= 10.6

I'm searching for a solution to do File icon overlays (icon badging) (like Dropbox does it on mac) with cocoa on Mac.

Does anyone knows a way to do this?

I've searched the Xcode docs and looked into scpplugins source code which is kind of old carbon code.

like image 539
Jonas Schnelli Avatar asked Dec 08 '11 08:12

Jonas Schnelli


1 Answers

A litte bit late, but maybe will be help someone.

I solved same problem with class NSWorkspace (see setIcon:forFile:options)

Basic idea:

  1. Try to get preview of file with QLThumbnailImageCreate (if not NULL you will get thumbnail icon)

  2. If you didn't get thumbnail, then get default OS X icon for file (NSWorkspace iconForFile)

  3. Combine thumbnail (or default icon) with your badge

  4. Set new icon to the file (NSWorkspace setIcon:forFile:options)

like image 72
miham Avatar answered Nov 13 '22 21:11

miham