How to add a URL-tile to the Dock from an Installer?
How to add a URL-tile to the Dock from an Installer?
- Subject: How to add a URL-tile to the Dock from an Installer?
- From: Jay Koutavas <email@hidden>
- Date: Thu, 30 Dec 2004 20:10:24 -0500
Title: How to add a URL-tile to the Dock from an
Installer?
My product requirements are asking me to "Add two URL
item-thingies to the Dock on product install" (paraphrased.
:))
Reading through the cocoa-dev archive, there seems to be
consensus along the lines of "One shouldn't force something onto
the Dock, it's up to the user to define." Which I'm in agreement
with too, one should prompt the user for that. So, my Installer will
do the right thing and prompt first.
Now, getting down to the engineering business of modifying a live
running Dock, I first wrote the following shell script to do an
addition of a URL tile to the Dock. (A URL tiles are those shiny metal
'@' icons with a spring attached, seen on the right-hand side of the
Dock).
The script works great when executed from the command line,
though naturally the hard-coded user path needs to scoot. Here's the
script:
----
#!/bin/bash
defaults write
/Users/jay/Library/Preferences/com.apple.dock persistent-others
-array-add
'<dict><key>tile-data</key><dict><key>label</key><string>http://www.heynow.com</string><key>url</key><dict><key>_CFURLString</key><string>http://www.heynow.com</string><key>_CFURLStringType</key><integer>15</integer></dict></dict><key>tile-type</key><string>url-tile</string></dict>'
killall -HUP Dock
----
The problem I'm running into is when I try to use the above
within my PackageMaker's postinstall script. What occurs is the entire
com.apple.dock.plist file gets reset to the factory default.
My postinstall script must be silently failing somehow (no
mention of an error in Console or the Install log) clobbering the
com.apple.plist and that the Dock, on restart wants to fallback to its
factory default com.apple.dock.plist as a recovery scheme. Any
suggestions on what to do? Any explanation of what my postinstall
shell script is doing wrong?
I realize that this post is a bit off topic for Cocoa-dev, but
there has been some discussion of programmatically tweaking the Dock
previously on this list. Nonetheless, suggestions on where to
cross-post are also welcome.
Happy New Year
/Jay
--
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Jay
Koutavas
mailto:email@hidden
Heynow
Software
http://www.heynow.com
Windham, New Hampshire, USA
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden