Wednesday, March 25, 2009

How to modify an application icon

Have you ever tried to change an application icon such that all files associated with that application show this same icon? If you have but have been unsuccessful, you may be interested in this post. I will show how to change the icon associated with pdf applications, though it'll be clear you can do the same with whatever other application.

1) Locate the desired icon you want to use as default for your pdf files (I took mine from this website).

2) It is advisable that you generate a svg file using the png icon image found above. You can do this by opening the icon file with Inkscape Vector Graphic Editor.

3) Go to /usr/share/icons/gnome/scalable/mimetypes directory and do a ls -l gnome-mime-application-pdf.svg. In my case, this symbolic link was pointing toward x-office-document.svg, which means that pdf files were using the oo generic icon as default.

4) Create a new symbolic link:
ln -s pdf_icon.svg /usr/share/icons/gnome/scalable/mimetypes/gnome-mime-application-pdf.svg

where pdf_icon.svg is the name of the icon I created in step 2.

5) Go to /usr/share/mime/packages and type (to create a backup just in case):

sudo cp freedesktop.org.xml freedesktop.org.xml_backup


6) Edit the freedesktop.org.xml file (type sudo gedit freedesktop.org.xml)

7) In the entry corresponding to the mime type you want to modify (in this case application/pdf), change the line that says generic-icon name="...." so it looks like generic-icon name="pdf_icon.svg"

8) Save the file.

9) In a terminal, type gconf-editor

10) Go to apps-->nautilus-->preferences. Look for the entry: show_image_thumbnails and change it to never.

11) In the terminal, type run killall nautilus

You should now see all pdf files with your new icon.

Enjoy!