Adding a folder from a user's home to the Dock - Any ideas?

bkvines
New Contributor III

Hello all,

I want to add a folder to a user's dock -- the user's Library/Printers folder -- and I'm running into a problem.

All our users (myself included) have our home folders on a Data partition. I can manually create the dock item fine, by opening my Library folder and dragging my Printers folder to the dock. But when I capture the dock item with Casper Admin, it picks up the full path to the item -- /Volumes/Data/Users/bkvines/Library/Printers. And if I deploy that dock item with Casper Remote to another computer, it's deployed with the path as it was captured. So it'll only work if I deploy it back to my computer, because nobody else is going to have my home folder on their computer.

Do any of you deploy dock items that are local to a user's home, and if so, how are you accomplishing this? I hope I'm not missing something blatantly obvious.

Thanks in advance.

-- Bryan Vines
bkvines at wgclawfirm.com

8 REPLIES 8

bkvines
New Contributor III

Unfortunately, Casper Admin doesn't allow access to the "Info" or "Options" tabs in the Info window for Dock items.

-- Bryan Vines
bkvines at wgclawfirm.com

ernstcs
Contributor III

You would need to script this, and I don't have more than a moment to at least respond, plus I'm on my iPad.

A script that grabs the currently logged in user name, and then use defaults to write to the dock that custom path perhaps. I think you need to relaunch the dock then.

This could be done as a login script which using $3 (I think, haven't used it in a while) should grab the username for you. The question is the execution frequency. You wouldn't want it to run for someone a second time, but perhaps the script can check to see if it already was by reading through the dock plist for a match, or if you've planted a file somewhere in their home the first time it ran, if it exists don't do it. Once per user would only be helpful if users didn't use multiple machines.

Maybe we need a once per user per computer frequency? I dont believe that exists. That's a feature request I guess, eliminates the running multiple times for the same user issue more gracefully.

If you did it while logged in for some reason then you'd have to grab who is on the console.

Hope that gives an idea. I might try to put this together later...

Craig E

Not applicable

You can grab who is on the console with this:

consoleUser=$(who | grep ' console ' | cut -f 1 -d ' ')

I'm not certain you can rely on being able to relaunch the Dock from a login script, as the Dock may not have started by the time the script runs. I could be wrong, though...

If you can do it, be warned that using the defaults command to add a Dock item could be tricky, as it's not just a simple value. And I don't think it would be feasible to check its existence from a shell script, either, for the same reason.

That said, PlistBuddy might help (/usr/libexec/PlistBuddy, at least in 10.6). I don't know much about it, but I think it provides a more robust language for interacting with plist files.

Not applicable

This is a job for dockutil:
On Feb 1, 2011, at 8:04 PM, Urban, Benjamin Mark wrote:

http://patternbuffer.wordpress.com/2008/05/16/dockutil-10-released/

-- Ben

bkvines
New Contributor III

Ben,

That. Is. Awesome.

Thanks. It does exactly what I need it to do!. Strange that in all the Googling I did, this utility NEVER showed up. And my Google-fu is usually pretty good.

-- Bryan Vines
bkvines at wgclawfirm.com

talkingmoose
Moderator
Moderator

Greg is a regular on the MacEnterprise list and a regular contributor to
On 2/3/11 12:44 PM, "Urban, Benjamin Mark" <BUrban at imf.org> wrote:
MacTech magazine too. To my knowledge, he's not a Casper user.

I suggest rather than trying to get him to come on this list that folks
subscribe to the MacEnterprise list instead. It's a valuable resource
whether you're using Casper or any other software to manage your Mac
environment. Discussion there applies to enterprise and education
administrators.

<http://lists.psu.edu/archives/macenterprise.html>

FYI, Edward Marczak who is co-author of the book that Thomas referenced,
is also a regular on the MacEnterprise list.

--

William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492

tlarkin
Honored Contributor

Macs are still catching up in the Enterprise world so a lot of what we are doing is very niche and not wide spread. Google searches will often not turn up anything at all. Heck, I have had to contact my enterprise support before to get clarification on certain aspects of Apple under-the-hood stuff, because google returns nothing. However, there is this guy named Greg Neagle, who is quite brilliant and is a co-author of a new book on managing Macs using MCX. His site is here:

http://managingosx.wordpress.com/

I suggest all of you book mark it, and read through it and if Google fails, use Google to search his site.

-Tom

Not applicable

Does anyone know the guy? I think he'd be very helpful on this list...

On Feb 3, 2011, at 1:31 PM, Thomas Larkin wrote:

Macs are still catching up in the Enterprise world so a lot of what we are doing is very niche and not wide spread. Google searches will often not turn up anything at all. Heck, I have had to contact my enterprise support before to get clarification on certain aspects of Apple under-the-hood stuff, because google returns nothing. However, there is this guy named Greg Neagle, who is quite brilliant and is a co-author of a new book on managing Macs using MCX. His site is here:

http://managingosx.wordpress.com/

I suggest all of you book mark it, and read through it and if Google fails, use Google to search his site.

-Tom