Add a number to your xulrunner-based app's Mac OS X dock icon #2

Here is the code promised yesterday. Warning, David Humphrey told me that Carbon code from nsMessengerOSXIntegration.cpp is outdated (absolutely), ugly and possibly leaking. In the meantime, it's useful to have it if like me you really need a badge on your dock icon. Last point, I have not installed Snow Leopard yet so it's untested on OS X 10.6...

Just look at the IDL to understand how it works, it's really simple.


1. On Wednesday 16 September 2009, 16:52 by Jean-Marie LAFON


You can add a badge to an icon in the dock in Cocoa (Not Carbon) like that :

int count = 3;
NSDockTile *aTitle = [[NSApplication sharedApplication] dockTile];
[aTitle setBadgeLabel:[NSString stringWithFormat:@"%i",count]];

You can also make the icon jumping with :
[NSApp requestUserAttention: NSInformationalRequest];

Hope it can help.