Specify the Finder icon with Avahi

Finder shared area icons Yesterday, I blogged about my various issues setting up Apple Filesharing on the Debian virtual server I’ve got running in Parallels. As of OS X 10.5, Leopard, the Finder has a shared area which shows the machines it’s discovered via Bonjour so you can easily connect to them. Today I got bored of having the default icon for my server, bizarrely Apple have set the default icon as a Cinema Display (what?), I wanted something more visually informative. After some Googling around and a bit of configuration on the Debian side, the server is now using an XServe icon.

This all takes advantage of an enhancement Apple added in Leopard, which allows a savvy server to specify its type and model. Leopard then uses one of its icons for various Mac hardware to represent that server.

Finder shared area icons The MacRumours forums provided the solution to how to configure Avahi to specify the hardware type in it’s broadcast announcement. Before starting to mess around, I had the following text in my Avahi service definition at /etc/avahi/services/afpd.service (N.B. that path is for a Debian machine, other distros may put their service definitions elsewhere):

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
</service-group>

After my alterations, the file read (I’ve emboldened the new portion):

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=RackMac</txt-record>
</service>
</service-group>

The model information I’ve used, sets the icon to an XServe icon (see the screenshot above). You can determine the model text you need to broadcast for other icons by digging through the Plist at /System/Library/CoreServices/CoreTypes.bundle/Contents/Info.plist.

Join the Conversation

25 Comments

  1. Hi,

    Exactly what i was looking for!! Now my NAS shows up as a Xserve device instead of an iMac :-)

    Greetz
    Eldrik

  2. Excellent tip! Thanks a lot!

    For the lazy ones, these are other possible models:

    Xserve (same a RackMac)
    PowerBook
    PowerMac
    Macmini
    iMac
    MacBook
    MacBookPro
    MacBookAir
    MacPro
    AppleTV1,1
    AirPort

    There is a lot of submodels defined. But for those you’ll have to look in the plist.

  3. Is there a possibility of editing this .plist file and adding diff models? I’m looking at the .plist file right now and testing it…

    1. Hi Nils,

      Did you ever get your tests with modifying the Info.plist file to work? I want to add a custom icon to Finder for a remote device mounted onto my Snow Leopard Mac. My device’s Avahi/AFP service config contains “model=DeviceX”. And I’ve copied my DeviceX.icns file into /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources. But I haven’t figured out what changes I need to make to the Info.plist. If you have any suggestions for me, let me know. Thanks.

      By the way, if anyone else has suggestions for me, I’d appreciate hearing them.

      Mark

  4. Does anyone know how to accomplish this with mDNSresponder instead of Avahi ?

    FreeNAS is forced to use mDNSresponder due to storage constraints for the emmbedded version so Avahi is out of the question..

    Thanks in advance,

    Adi

  5. Adi, you can do the same with mDNSresponder by adding the following to the config file:

    your-machines-hostname
    _device-info._tcp.
    1
    model=Xserve

    1. Hi !

      Where is the config file located ? On which position should I add ? When I change the file in /etc/rc.d/ or in /var/etc/ the changes are gone after rebooting the machine.

      Thanks

  6. You can also let your device come up as a nifty iPhone icon by using the iPhone2,1 identifier. Very nice :P

  7. Here are the Models I found (there are other machine icons for Mac mini servers but there are no associated model codes):
    – Windows
    – Macintosh
    – PowerBook (Titanium) PowerBook6,1 (G4 12″) PowerBook5,2 (G4 15″) PowerBook5,1 (G4 17″) PowerBook 6,3 (iBook G4)
    – PowerMac (G4) PowerMac3,5 (G4 QS) PowerMac3,6 (G4 MDD) PowerMac7,2 (G5)
    – Xserve
    – Macmini1,1 Macmini4,1 (Unibody)
    – PowerMac4,4 (eMac)
    – PowerMac4,2 (iMac G4 15″) PowerMac4,5 (iMac G4 17″) PowerMac6,3 (iMac G4 20″) PowerMac8,1 (iMac G5 17″)
    – PowerMac12,1 (iMac G5 iSight 17″) iMac4,1 (iMac G5 iSight 24″)
    – iMac7,1 (Alu 20″) iMac9,1 (Alu 24″) iMac10,1 (Alu 27″)
    – MacBook1,1 (White) MacBook1,1,Black MacBook5,1 (Unibody) MacBook6,1 (Unibody Plastic)
    – MacBookPro1,1 (15″) MacBookPro1,2 (17″) MacBookPro5,1 (15″ Unibody) MacBookPro5,2 (17″ Unibody) MacBookPro5,5 (13″ Unibody)
    – MacBookAir1,1 MacBookAir3,1 (11″ Unibody) MacBookAir3,2 (13″ Unibody)
    – MacPro
    – AppleTV
    – iPhone1,1 iPhone1,2 (3G) iPhone2,1 (3GS) iPhone3,1 (4)
    – iPod1,1 (Touch) iPod2,1 (Touch 2 & 3) iPod4,1 (Touch 4)
    – iPad1,1
    – AirPort
    – TimeCapsule

  8. Hi,

    thanks for all the infos found here. I only like to add that it is not necessary to place the host icon information in the afpd.service file. It also works if you put it in an own file.


    %h

    _device-info._tcp
    0
    model=RackMac

  9. Which config file would one edit to make OS X broadcast as a different machine? i.e. a Mac Mini to be seen a “Rack Mac” by other Macs on the network? I can’t find info on that anywhere! Many thanks in advance for anyone who knows!

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.