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:
dpkg-query -L <packagename>
In my example of
dpkg-query -L placesfiles

this would among others, output the following images:
/opt/placesfiles/images/dir_icon.png
/opt/placesfiles/images/placesfiles64.png
/usr/share/pixmaps/placesfiles.png
...Which would make the search quite limited.
From man dpkg-query
:
-l, --list [package-name-pattern...]
List packages matching given pattern. If no package-name-pattern
is given, list all packages in /var/lib/dpkg/status, excluding
the ones marked as not-installed (i.e. those which have been
previously purged). Normal shell wildcard characters are allowed
in package-name-pattern. Please note you will probably have to
quote package-name-pattern to prevent the shell from performing
filename expansion. For example this will list all package names
starting with “libc6”:
In the case of Radiotray, I found the following .png
files (running dpkg-query -L radiotray | grep png
):
/usr/share/radiotray/images/radiotray_connecting.png
/usr/share/radiotray/images/radiotray_on.png
/usr/share/radiotray/images/radiotray_off.png
/usr/share/radiotray/images/radiotray.png
/usr/share/pixmaps/radiotray.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
example
dpkg-query -L radiotray | xargs grep icon
in the output we find a.o.:
/usr/lib/python2.7/dist-packages/radiotray/SysTrayGui.py
self.icon.set_from_file(APP_ICON_CONNECT)
Looking into the file SysTrayGui.py
, we can see:
from lib.common import APPNAME, APPVERSION, APP_ICON_ON, APP_ICON_OFF, APP_ICON_CONNECT, APP_INDICATOR_ICON_ON, APP_INDICATOR_ICON_OFF
From this, we can conclude the mentioned icons are defined in the module common
inside the (sub) directory lib
. (See here how python finds it modules, section Subdirectories)
In this module, we can read the section:
# Media path
if os.path.exists(os.path.abspath('../data/images/')):
IMAGE_PATH = os.path.abspath('../data/images/')
else:
IMAGE_PATH = '%s/%s/images' % (datadir, APPDIRNAME)
# Images
APP_ICON = os.path.join(IMAGE_PATH, 'radiotray.png')
APP_ICON_ON = os.path.join(IMAGE_PATH, 'radiotray_on.png')
APP_ICON_OFF = os.path.join(IMAGE_PATH, 'radiotray_off.png')
APP_ICON_CONNECT = os.path.join(IMAGE_PATH, 'radiotray_connecting.gif')
APP_INDICATOR_ICON_ON = "radiotray_on"
APP_INDICATOR_ICON_OFF = "radiotray_off"
APP_INDICATOR_ICON_CONNECT = "radiotray_connecting"
...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:
gdbus call --session --dest com.canonical.indicator.application --object-path /com/canonical/indicator/application/service --method com.canonical.indicator.application.service.GetApplications
... which gives us quite some useful information. The output included a section:
('146028888067', 2, 'org.kde.StatusNotifierItem-22055-1', '/StatusNotifierItem/menu', '/tmp/iconcache-50ePXx', '', '', '', 'owncloud', 'ownCloud')
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...
dpkg -L
do the same thing? – Kaz Wolfe Dec 27 '16 at 21:03dpkg-query -L
. Searching withfind / -name state-ok -type f
looks to have stalled but I'll leave it running overnight. – Tom Brossman Dec 28 '16 at 19:27owncloud-client
from the opensuse PPA. – Tom Brossman Dec 28 '16 at 19:40/usr/share/icons/hicolor/<size>/apps
though. Unfortunately, the .deb file does not install:Errors were encountered while processing:
I will retry later... – Jacob Vlijm Dec 28 '16 at 20:19