Icon / mime association..

Magnus Bergman magnus.bergman at observer.net
Thu Oct 12 18:24:10 EEST 2006


On Wed, 11 Oct 2006 21:25:22 +0300
Kustaa Nyholm <feedback2 at sparetimelabs.com> wrote:

> Magnus Bergman wrote:
>   The icon for a mimetype is expected to be in
> > DATADIR/icons/THEME/*/mimetypes. In other words, the icon used
> > depends on the current theme [3]. 
> First of all, thank you for taking the trouble to explain.
> 
> I'm almost there but after experimenting with Ubuntu for an hour now
> I still do not get it to work for me.
> 
> Gnome shows the mime type correctly for my document files and when I
> double click them the application launches correctly. And I've even
> got a nice icon for my application showing up in the 'applications'
> folder.
> 
> But I can't figure out the correct name / place for the icon for mime
> types.
> 
> I think it should be in
> /usr/share/icons/hicolor/48x48/mimetypes

Yes, that is correct. If you use autoconf it is a good idea to
place it get the datadir from there instead of assuming it to
be /usr/share.

> but what is the correct file name  given my mime type
> 'application/vnd.jdwg' ?

The spec implicitly says that the slashes and hyphens should be
replaced by underscores. It doesn't seem to say anything about the dot
thou. Looking at the Gnome icon theme you can see it has hyphens
instead of underscores in the filenames so that seems to work too. But
according to the spec I'd say I should be:

application_vnd.jdwg.png

Now you might not be the one who came up with this mimetype. But if it
was, you should consider renaming it to
'application/vnd.VendorName.Type' to follow standards.

> And do I need a theme.index file?

No. Only if you create your own theme.

> A minor issue is that, like I said, the application's 'myApp.desktop'
> file has a nice icon which launches the application but the actual
> executable doesn't have the same icon. Is there a way to change this?

Yes. Modify the application to look up the same iconname in the way
specified in the icon theme (some toolkits lite GTK+ can do this by
itself). In that way the same icon will be found, even if some theme
provides an alternative icon for your application, that will be used
both for the launcher and the running application.



More information about the xdg mailing list