I'd like to find the location of the icons used by some non-default status menus (also called application indicators or indicator applets).
Where are these icons image files located?
In my screenshot I have ownCloud and Radiotray, but I would like a general answer not specific to these particular icons please. I don't know the file names or file types so searching is difficult.
Default location for non-default indicator icons?
There is no default location where these icons are stored. Any application (-developer) can store them where it is considered appropriate.
However, the good news is that indicators usually do not install endless lists of files and images. We can limit our search by (apart from looking into the code) looking into the output of the command:
In my example of
this would among others, output the following images:
...Which would make the search quite limited.
From man
dpkg-query
:In the case of Radiotray, I found the following
.png
files (runningdpkg-query -L radiotray | grep png
):If we really need to find out, searching the code
...we can look through (inside) installed files for matches of the string "icon". Many of the indicators are written in one of the script- languages (like
python
), which means they are very well search-able.An example
Again using the
radiotray
examplein the output we find a.o.:
Looking into the file
SysTrayGui.py
, we can see:From this, we can conclude the mentioned icons are defined in the module
common
inside the (sub) directorylib
. (See here how python finds it modules, section Subdirectories)In this module, we can read the section:
...and here we are...
Exceptional situations
With practical all of my indicators, I managed to find the corresponding icons using the method(s) above.
In turns out to be possible however, to compile images together with the code into a single executable. No need to explain that in such cases you will not find a separate image, nor will you be able to replace them without editing the code and recompile.
The case of owncloud seems to be such a case. Using the above method(s) showed a set of icons was installed inside
/usr/share/icons/hicolor/<size>/apps
. None of these icons turns out to be used however in the indicator on ubuntu.OP did quite some work before (and after) he asked this question. One of them was to run:
... which gives us quite some useful information. The output included a section:
Looking into the directory
/tmp/iconcache-50ePXx
, I found the exact icons that were used by the indicator:... which seems to prove these icons are generated on the fly; closing owncloud makes the directory and its icons vanish.
It turned out to be possible to change the indicator's icon by replacing these icons:
which proves these are indeed the icons we were looking for.
To automate what I did manually however, would requires a script/wrapper, since the created directory's name is changed every time owncloud is launched. The most convenient option would of course be that the owncloud-client's code would be changed.
See also our discussion here.
To be continued...
Icons and their potential locations
There's two ways indicator could employ icons:
/usr/share/pixmaps/
, although it's possible some of the authors send indicator icons to other directories. Jacob Vlijm, whose answer is on this page and who is also author of SpaceView indicator, for example, chose to place icons for that indicator into/opt/spaceview/icon
. With these type of icons it's slightly tricky but not complex - usedpkg -L <package name>
orcat /var/lib/dpkg/info/PACKAGE.list
and search for an icon file, with.png
or.svg
extension. These are most typical/usr/share/icons
folder. For instance, in my indicators such as Udisks Indicator, I frequently rely on what's in/usr/share/icons/gnome
, since these are standard and come with any Ubuntu installation. If you don't find an icon from queryingdpkg
, chances are the package uses a standard icon.Going to the source
If an indicator is written in Python or Ruby, looking through source code for clues can be relatively easy, since these are scripts, and it is sufficient to use
grep
to search through the source code. Compiled languages such as C and Vala don't come with source code, so you would have to obtain it, either viaapt-get source package-name
or from wherever you obtained the package. ( Adventurous users could usehexdump
or decompile the executable file, but IMHO it's too much work just for curiosity about an icon ).NOTE: if an icon resides in one of the standard directories, such as
/usr/share/icons/
or/usr/share/pixmaps
, the author of the software may choose to call the icon simply by name, without extensions. For example, in myudisks-indicator
I use this line to call one of the standard icons:Notice the lack of
.svg
or.png
extension. Thus, in this case, we have a name of the icon, and we can locate it using Linux standard commands such aslocate
orfind
.Search using standard Linux tools
If you really want to have a command for searching icons, just use this simple combination:
Here's an example. I know for a fact that indicator diskman uses a custom icon. So what does this command tell us ?
Notice the
/usr/share/pixmaps/indicator-diskman.png
the last image, which is what the indicator actually shows on the panel.And what if the indicator uses a standard icon ? Well obviously there will be no output:
Conclusion
While there's no set standard, there's set of typical places where icons go, and we can use
dpkg
to query information about what files come with each specific package. Finally, maybe it's not the most technical suggestion, but consider sending developers an email or stopping by their IRC or chat, and simply asking them "Hey, what icon does your indicator use?". Developers usually are glad to hear from people who use their software and won't mind to answer a quick question.