Albert
Albert

Reputation: 68140

Cocoa: add another dock icon at runtime

Is it possible to add another icon to the dock at runtime without using [NSWorkspace launchApplication:]?

How?


Before you say 'no': I am willing to use stuff like fork() etc.

I actually tried a bit with fork() but I get the error:

The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_COREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.

Upvotes: 2

Views: 795

Answers (2)

Thomas Zoechling
Thomas Zoechling

Reputation: 34253

If you want to add an additional icon to the Dock, Yuji's answer is the easiest solution.
If you want to change the existing icon of your app, you can create a Dock tile Plug-In.
Those Plug-Ins were introduced with Snow Leopard and they allow you to display small informations even when your app is not running. (Like iCal's icon, which always shows the current date).

Apple's Dock tile Plug-In docs: http://developer.apple.com/library/mac/#documentation/Carbon/Conceptual/customizing_docktile/CreatingaDockTilePlug-in/CreatingaDockTilePlug-in.html#//apple_ref/doc/uid/TP30000986-CH4-SW1

Upvotes: 0

Yuji
Yuji

Reputation: 34185

Launch another application, via e.g. [NSWorkspace launchApplication:].

Upvotes: 1

Related Questions