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.