I'm working on a small project at home that would add a badge (aka icon overlay) to a specific file based on its state. Anyway, I've Googled the hell out of it and the only documentation I was able to find was on Apple's developers site (Obtaining and Using Icons With Icon Services).
The documentation expects the developer to be familiar with Objective-C file APIs, which I'm not. So, I'm wondering if someone can please give me some code examples for adding badges to a file and directory. Thanks in advance!!
On your Mac, select the file or folder. Choose File > Get Info in the menu bar. At the top of the Info window, select the small custom icon.
After pulling up Finder > Applications, find the app you'd like to change the icon for. Right click and select Get Info or use the keyboard shortcut command + I. Now just drag the new image you want to use on top of the existing icon (you can also copy the new image then paste it onto the existing icon).
To do this: Right-click the folder that you want to create a shortcut to, and then click Create Shortcut. Right-click the shortcut you created, click Properties, and then click Change Icon. Click the picture of the icon you would like the shortcut to use, click OK, and then click OK.
If you're the curious type, you might want to take a peek at Mac OS X's system icons. The system icons bundle, found in the /System/Library/CoreServices directory, stores about 140 icons. Start by opening a Terminal window, then change directories to /System/Library/CoreServices/SystemIcons. bundle/Contents/Resources.
How about diving into the sources of SCPlugin. I believe they are doing something that works. The code is here http://scplugin.tigris.org/svn/scplugin/trunk, login with "guest" and no password. I won't say it's easy...
(source: tigris.org)
The link you posted to is for the Carbon (pre-MacOSX) API. Whilst it might work in the Carbon finder of 10.5, the Finder in 10.6 is pure Cocoa and as a result of which might not support the concept of badges in that regard.
You can add badges to an application in the dock with NSDockTile but you won't have much luck in documents for applications on the whole. You'd either need to monitor the documents through some other mechanism and then use, say, a QuickLook plugin to generate a miniaturized view with whatever your state happens to be.
Failing that, you could write your own view for the documents (in which you could add such information) rather than using Finder.
The Finder in 10.6 can be hack with a SIMBL plugin , you just have to use the swizzling method to reimplement the drawWithFrame method in the Finder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With