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.

24 thoughts on “Specify the Finder icon with Avahi

  1. Eldrik

    Hi,

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

    Greetz
    Eldrik

    Reply
  2. Pingback: Problems with .htaccess and AFP over Netatalk at simonwheatley.co.uk

  3. Remco

    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.

    Reply
  4. Nils

    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…

    Reply
    1. Mark Ikemoto

      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

      Reply
  5. Pingback: Benjamin Sherman » Bonjour Avahi Addendum

  6. Pingback: SUNWfrk’s Blog » Specify the Finder icon with Avahi on OpenSolaris 2008.11

  7. Adi

    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

    Reply
  8. unreality

    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

    Reply
    1. cako

      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

      Reply
  9. Pingback: Mac OS X – Computer Icons ändern — instant-thinking.de

  10. Pingback: Specifying the Finder icon with Avahi | Dustin's Blog

  11. Pingback: Setting up Ubuntu 10.04 LTS PowerPC as a NAS + TimeMachine for OS X « denniswever.dyndns.org

  12. Pingback: Redvix - Create an Apple File Server on Ubuntu Server 10.04 with Time Machine Support

  13. Yvan BARTHÉLEMY

    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

    Reply
  14. Pingback: mdnsadv e modello di mac esportato | tazzadelcesso.com

  15. kdw

    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

    Reply
  16. Pingback: Napp-it : where is the Avahi Service Definition file?

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>