Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

The question is about customizing the way icon appears at

  1. desktop shell
  2. notification area
  3. file associations

    [Desktop Entry]
    Version=1.0
    Type=Application
    Name=Mathematica 9
    Comment=Technical Computing System
    Exec=/usr/local/Wolfram/Mathematica/9.0/Executables/Mathematica %F
    Icon=wolfram-mathematica
    MimeType=application/mathematica;application/vnd.wolfram.cdf
    Categories=Education
    

Now provided I can make a custom desktop file where I can place png file location at icon...but how come the above desktop file is referring to an icon & where is that icon (wolfram-mathematica)?

Secondly how to system wide change icon of a special file type say a docx to something else enter image description here

Third & last how gnome load tray icons & where are those icons stored e.g I want to customise autokey tray icon to something else how can I do it? Have also looked at /usr/share/pixmaps but to no avail

enter image description here

share|improve this question

1 Answer 1

up vote 1 down vote accepted

First, desktop files aka "launchers" (should) comply to freedesktop specs. As to the icon, the above specification explains:

Icon to display in file manager, menus, etc. If the name is an absolute path, the given file will be used. If the name is not an absolute path, the algorithm described in the Icon Theme Specification will be used to locate the icon.

the algorithm being:

Icons and themes are looked for in a set of directories. By default, apps should look in $HOME/.icons (for backwards compatibility), in $XDG_DATA_DIRS/icons and in /usr/share/pixmaps (in that order).

........................................................................

The icon lookup mechanism has two global settings, the list of base directories and the internal name of the current theme. Given these we need to specify how to look up an icon file from the icon name and the nominal size.

The lookup is done first in the current theme, and then recursively in each of the current theme's parents, and finally in the default theme called "hicolor" (implementations may add more default themes before "hicolor", but "hicolor" must be last). As soon as there is an icon of any size that matches in a theme, the search is stopped. Even if there may be an icon with a size closer to the correct one in an inherited theme, we don't want to use it. Doing so may generate an inconsistant change in an icon when you change icon sizes (e.g. zoom in). The lookup inside a theme is done in three phases. First all the directories are scanned for an exact match, e.g. one where the allowed size of the icon files match what was looked up. Then all the directories are scanned for any icon that matches the name. If that fails we finally fall back on unthemed icons. If we fail to find any icon at all it is up to the application to pick a good fallback, as the correct choice depends on the context.

As per the above, on most modern desktops, icon themes location is $XDG_DATA_DIRS/icons, that is /usr/share/icons (global) and ~./local/share/icons (user).


Second, changing an icon for a file type system-wide involves changing the mimetype icon coresponding to that file mime type, i.e. for .docx files the mime type is

application/vnd.openxmlformats-officedocument.wordprocessingml.document

Gnome default icon set has no icon for that specific mime type so it falls back to x-office-document (full path being /usr/share/icons/gnome/$SIZE/mimetypes/x-office-document). Changing the icon for .docx means you either have to come up with a new icon (of various sizes) named

application-vnd.openxmlformats-officedocument.wordprocessingml.document.png

or replace the x-office-document.png that is used by default. Note the latter will change the icon for all files associated with x-office-document mime type, not only .docx.

It is not recommended to alter icon themes in /usr/share/icons as your changes will most likely be overwritten by future updates so your best bet is to place your favorite icon theme in ~./local/share/icons and add/modify whatever you want.


Finally, identifying the tray icons used by Gnome is not a trivial task, see this on AskUbuntu. Not sure if it applies to Gnome 3.6 since some shell parts are still under major rearchitecture and code changes every release.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.