dafi
dafi

Reputation: 3522

Cocoa osx: Add a menu item on dock elements for all running applications

I'm working to an application for OSX and I would to add a new menu item on the menu shown when you click on a dock icon. The menu isn't for my application but it must appear for all running apps.

I've found only this doc http://cocoadevcentral.com/articles/000036.php but it adds to its own app.

My app will run on OSX 10.6 or superior

Upvotes: 0

Views: 970

Answers (1)

Yuji
Yuji

Reputation: 34185

You can't do that with the public API. You need to inject code into the Dock. In 10.6, the standard way to inject the code is to use the OSAX loading trick, described in this blog post for that. Then you need to do Objective-C runtime hackery to replace the method, using method_exchangeImplementations.

Anyway it's a tricky process. But if you have the will, you can. SIMBL might (or might not) help you.

Upvotes: 3

Related Questions