Showing Network Volumes in the Sidebar

At work I have a user that really, really was having a hard time with Network Shares being moved to under Network in Leopard instead of showing up with the rest of the Volumes as they used to in Tiger. After a bit of digging around I found the following information but failed to figure out how to create a script to automagically put Network shares in the Devices section of your sidebar but if you’re managing several computers it is possible to copy the com.apple.sidebarlists.plist file saving a lot of time.

When a network share is mounted in Leopard it does not appear in the Finder sidebar on it’s own - it is accessible via the server it is on if you have Connected Servers checked off in the Finder preferences. At work we have Back to My Mac, Connected Servers, and Bonjour Servers all hidden by default because they do little to assist anyone in finding anything. (Not to mention Back to My Mac isn’t used and Bonjour Servers lists every computer in the building). Your one alternative was to navigate back to the Computer (Command-Shift-C) and find your Volume there - instead what you can do is drag a Network share to your sidebar (or press Command-T when it is selected) where if mounted it will appear.

What I wanted to do was make it so they would automatically appear no matter what was connected - making the change more future proof. I ultimately failed to do so but I did learn the following tidbits about com.apple.sidebarlists.plist:

Under :systemitems:VolumesList (PlistBuddy syntax in use) you have a list of different hard drives and such that have been plugged into your computer - and if you happen to add a share to your sidebar this portion is what is changed.

Each Item consists of:

  • An Alias (Data) - This is the base64 decoded form of a _CFULRAlias (identical to as seen in com.apple.dock.plist)
  • EntryType (Integer) - I found the codes for several different types:
    16: Special Access (Computer, iDisk, Network)
    261: Hard Drive (and ZFS Pool)
    517: Time Machine
    515: USB Drive
  • Icon (Data) - Again this is Hex but if you have a hex editor (such as Hex Fiend) but is the form “ImgR? SYSL fldr” (Default Finder Folder icon) with two fields separating each section. The default for a server icon is: 496d6752 0000001c 00000000 5359534c 00000010 00000000 73727672
  • Visibility (string)(optional) - Can be NeverVisible or AlwaysVisible. In this case we want AlwaysVisible.

My big issue in not being able to figure it out was that I couldn’t figure out through research how to write the necessary alias data that is being looked for by com.apple.sidebarlists.plist . James Reynolds created the dockit.c program. Tweaking the program so it’s start and end points only included the CFURLAlias data (329 and 326 respectively) gave me the base64 encoded information that you see when editing an XML version of the Dock or Sidebarlists plists - but using PlistBuddy to input the information did no good.

So what I ended up doing instead was to use one computer to mount all the possible shares put them in the sidebar (since they’re hidden when not mounted it’s fine having shares that wouldn’t even be mounted) and then push out the changes via MCX. It’s not perfect but it works and it will make finding the shares much easier. I’m hoping this entry helps someone else on their search for getting such a script created.

Thanks to the following places for information:
CocoaDev (note: The Alias data when viewed in an xml plist is base64 encoded - but not in Property List Editor)
JeremyForPresident
MacOSXHints