Mac GeekeryGet your geek on. |
|
blog advertising is good for you
recent popular content
User login
|
As an admin, sometimes you want to tweak the dock a bit when you can’t sit at the Mac or VNC in to it. Luckily, the Dock is governed by a plist that’s a bit cryptic, but is otherwise fairly easy to tweak. I used this quite a bit, back in the day, but when a friend asked me for it recently, I had to dig around quite a bit to find the darn thing. The BasicsThe
{
GUID = 1883183727;
"tile-data" = {
"file-data" = {
"_CFURLAliasData" = <00000000 00b40003 00010000 c107bb6f 0000482b 00000000 0000013d 00000a22 0000bfee 53de0000 00000920 fffe0000 00000000 0000ffff ffff0001 00080000 013d0000 013c000e 001a000c 00540065 0072006d 0069006e 0061006c 002e0061 00700070 000f001a 000c004d 00610063 0069006e 0074006f 00730068 00200048 00440012 00234170 706c6963 6174696f 6e732f55 74696c69 74696573 2f546572 6d696e61 6c2e6170 70000013 00012f00 ffff0000 >;
"_CFURLString" = "/Applications/Utilities/Terminal.app/";
"_CFURLStringType" = 0;
};
"file-label" = Terminal;
"file-mod-date" = 3220067294;
"file-type" = 41;
"parent-mod-date" = 3250793941;
};
"tile-type" = "file-tile";
},
Thankfully, we don’t care about roughly half of that. We just need to build something that looks like this:
{
"tile-data" = {
"file-data" = {"_CFURLString" = "/Applications/Terminal.app/"; "_CFURLStringType" = 0; };
};
}
It’s a little much to have to type in every time, what with matching brackets and escaping chars here and there, but the basic command to accomplish this is as follows:
The Dock doesn’t have any notifications set looking for external changes to this file, so it’ll ignore what you do until you logout or kill the Dock. Getting FunkyAll that nested XML is a pain in the ass to type in repeatedly, so I made a bash funct in my profile to handle both the
If you really want to, $ dockadd /Application/Foo.app When the Dock comes back up, your new item should be on the Dock.
About JC
Author Biography JC is a former Mac Genius and Mac-centric IT worker with a background in print advertising. He earned a reputation as a miracle worker when he saved the day at a new business pitch with the arcane knowledge that Apple’s ADB cables were nothing more than poorly shielded S-Video cables. JC runs the Heroic Efforts Data Recovery Service and writes Ungenius, a tawdry tale of the life and times of a former Mac Genius. You can contact JC via IM or via the contact form. |
Sorry for the stupid question, but how can I modify the script to add stuff to the documents side of the Dock?
just change the “persistent-apps” to “persistent-others”.
http://lucidsystems.org/luciddocktools.html
Works quite nicely in my experience, and it adds things to the correct location based upon whether they’re an app or a folder/file.
ah yes. i meant to mention
additemtodock. It’s a nice tool… I just don’t want to have to install software packages to all the Macs I admin, and copying my .bash_profile is already part of my routine.Agreed, but is this still necessary? I can add an item to the Dock, then immediately run
killall Dockand the changes are preserved. I can even runkillall -9 Dock.fseventer suggests that the Dock writes out changes just as soon as you make them.
It’s not really a big deal; both ways work. But I prefer to stick with shell when in a shell script (or function), and using
killwill execute a little bit faster.The Dock usually writes changes immediately, but is not consistent about it. My bad on implying that it never does, but it’s still safest to ‘quit’ it.
And I think you’ll find that the speed difference between them is negligible to the extreme.
How to get the list of apps currently in the Dock
How about removing items?
I am trying to find out the same thing. But removing is pretty easy to do manually just the same, as long as the machine is accessible.
Adding an item takes far longer than removing one.
I have not been able to find a “remove” so far.
JC, excellent script! Any idea on how to remove items from the array? So far the only idea I have is to read both the persistent apps and others, cull the offending app from the list and then recreate the whole array which seems a bit overkill. From the man page it seems there is only a -array-add flag and no tool to remove, other than the whole array…
We’re on network homes so this script would be very useful when we push new images out and there are app changes…