Posted on 02-19-2016 10:53 AM
I'm using dockutil and loving it. But I'm hoping to accomplish one thing that may not be possible: Is it possible (with dockutil or otherwise), to add a network share point with a custom icon?
Solved! Go to Solution.
Posted on 02-19-2016 11:36 AM
Yes, but the share has to be mounted first for it to pick up the icon.
With one mounted in the standard /Volumes/ path, just run
dockutil --add /Volumes/VolName
It will end up at the end of the Dock in folders section, complete with the icon. It will act to mount the share if not mounted when the Dock icon is clicked on, provided it can authenticate, or will prompt for authentication I believe.
To my knowledge, if you try to add it in without the share mounted, it will either fail if you use a direct path, or if you use something like smb://path/to/share
then it gets added in with a generic globe icon.
Unless by "custom icon" you meant adding in a share and customizing the icon to something other than its real icon? if so, I don't think that's possible, but maybe explore Applescript to see if there's some way with that.
Posted on 02-19-2016 11:36 AM
Yes, but the share has to be mounted first for it to pick up the icon.
With one mounted in the standard /Volumes/ path, just run
dockutil --add /Volumes/VolName
It will end up at the end of the Dock in folders section, complete with the icon. It will act to mount the share if not mounted when the Dock icon is clicked on, provided it can authenticate, or will prompt for authentication I believe.
To my knowledge, if you try to add it in without the share mounted, it will either fail if you use a direct path, or if you use something like smb://path/to/share
then it gets added in with a generic globe icon.
Unless by "custom icon" you meant adding in a share and customizing the icon to something other than its real icon? if so, I don't think that's possible, but maybe explore Applescript to see if there's some way with that.
Posted on 02-20-2016 01:22 AM
@gskibum how do you want the icon to behave?
By adding a share that's not mounted you'll get the generic icon. Once the share is mounted it will show the contents.
So not sure how the icon is expected/wanted to work.
If it's just an icon that a user clicks then opens a share, that can be done via an AppleScript app.
Posted on 02-24-2016 07:46 AM
Thank you both for your replies. Been busy the last couple of days. I'll write a more detailed response hopefully tomorrow.
Posted on 11-08-2020 06:22 PM
We are using dockutil to go to a https URL. Couldn't figure out 'yet' how to change the icon to the relevant link.
Imagine having 10 URLs in the dock and the user has to hover over each one to figure out which one to click :)
Posted on 11-10-2020 01:53 AM
@khurram We are doing something along these lines…
#!/bin/sh
## postinstall
# Generate a help and support url file.
user=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )
DOCK_UTIL="/tmp/dockutil"
HelpURL="/tmp/website.webloc"
python -c 'import Cocoa; Cocoa.NSWorkspace.sharedWorkspace().setIcon_forFile_options_(Cocoa.NSImage.alloc().initWithContentsOfFile_("/tmp/QMarkB.png"), "/tmp/website.webloc", 0)'
# Add it to the dock
sudo -u $user $DOCK_UTIL --add $HelpURL --section others
exit 0 ## Success
exit 1 ## Failure
Posted on 11-19-2020 09:55 AM
@remus I noticed you are running the dockutil binary in the user context, is this how you usually manage your user's Dock from Jamf scripts? Does this work in macOS 10.15 Catalina?
Example: sudo -u $user $DOCK_UTIL