Re: How to add a URL-tile to the Dock from an Installer?
Re: How to add a URL-tile to the Dock from an Installer?
- Subject: Re: How to add a URL-tile to the Dock from an Installer?
- From: Darkshadow <email@hidden>
- Date: Fri, 31 Dec 2004 07:42:21 -0500
The problem is that the file is getting owned by root, and since
*.plist files are only rw for the owner, the user's dock can't access
its preferences anymore and so starts up with the default preferences.
You'll need to either set the owner back, or change the permissions so
that everyone can read/write. I'd choose the former.
Err, and if it helps, the scripts that are run don't actually *have* to
be scripts - you can make a small tool to do the job. The installer
will run anything that's executable.
Hope that helps,
Darkshadow (aka Michael Nickerson)
On Dec 30, 2004, at 8:10 PM, Jay Koutavas wrote:
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
--
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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