1

Possible Duplicate:
Add/remove application icon from dock at runtime?
Programmatically add application icon to dock on install

I am wondering how I can add my app icon to the dock programmatically (so that it remains in the dock except if the user removes it). Please don't answer that it is forbidden to do that, I really need to do this for a specific need :)

I have seen these threads:

Programmatically add application icon to dock on install

Add/remove application icon from dock at runtime?

But they do no answer the question.

Any idea?

Community
  • 1
  • 1
toto_tata
  • 14,526
  • 27
  • 108
  • 198
  • [Add/remove application icon from dock at runtime](http://stackoverflow.com/questions/8317101/add-remove-application-icon-from-dock-at-runtime) is about whether an app will appear in the Dock **when it is running**. This question is about permanent members of the Dock. [The other question](http://stackoverflow.com/questions/13451234/mac-osx-auto-add-app-in-dock-bar-after-install-app) is more like this question. – JWWalker Dec 19 '12 at 19:19
  • Regis, the question "Mac OSX - Auto add app in dock bar after install app" does seem to answer your question. Basically, you write to the Dock preference file and then restart the Dock process. – JWWalker Dec 19 '12 at 19:29
  • It isn't forbidden. Apple itself does that in their installers. But any app or installer that dares to fiddle around with my system setup w/o my permission and for no particular reason, is simply misbehaving and software which I will ban from my system because if it is already misbehaving in that aspect I don't want to find out in what other aspects it may also be misbehaving. – Mecki Oct 20 '16 at 12:26
  • And the first question you've been linking to *DOES* answer the question, you just need to read it, then you'll see, that it links to two pages that show exactly how this done, once from within a shell script and once from within an AppleScript. Of course both ways would also work in a Cocoa or Swift app - but if you want to use Obj-C code, here's the Obj-C version: http://www.danandcheryl.com/2011/02/how-to-modify-the-dock-or-login-items-on-os-x – Mecki Oct 20 '16 at 12:32

0 Answers0