Some things about where icons for modern X applications come from
If you have a traditional window manager like fvwm, one of the things it can do is iconify X windows so that they turn into icons on the root window (which would often be called the 'desktop'). Even modern desktop environments that don't iconify programs to the root window (or their desktop) may have per-program icons for running programs in their dock or taskbar. If your window manager or desktop environment can do this, you might reasonably wonder where those icons come from by default.
Although I don't know how it was done in the early days of X, the modern standard for this is part of the Extended Window Manager Hints. In EWMH, applications give the window manager a number of possible icons, generally in different sizes, as ARGB bitmaps (instead of, say, SVG format). The window manager or desktop environment can then pick whichever icon size it likes best, taking into account things like the display resolution and so on, and display it however it wants to (in its original size or scaled up or down).
How this is communicated in specific is through the only good
interprocess communication method that X supplies, namely X
properties.
In the specific case of icons, the _NET_WM_ICON
property
is what is used, and xprop
can
display the size information and an ASCII art summary of what each
icon looks like. It's also possible to use some additional magic
to read out the raw data from _NET_WM_ICON
in a useful format;
see, for example, this Stackoverflow question and its answers.
(One reason to extract all of the different icon sizes for a program is if you want to force your window manager to use a different size of icon than it defaults to. Another is if you want to reuse the icon for another program, again often through window manager settings.)
X programs themselves have to get the data that they put into
_NET_WM_ICON
from somewhere. Some programs may have explicit
PNGs (or whatever) on the filesystem that they read when they start
(and thus that you can too), but others often build this into their
program binary or compiled data files, which means that you have
to go to the source code to pull the files out (and they may not
be in a bitmap format like PNG; there are probably programs that
start with a SVG and then render it to various sized PNGs).
(As a concrete example, as far as I know Firefox's official icons
are in the 'defaultNN.png' files in browser/branding/official.
Actual builds may not use all of the sizes available, or at least
not put them into _NET_WM_ICON
; on Fedora 29, for example, the
official Fedora Firefox 66 only offers up to 32x32, which is
tragically small on my HiDPI display.)
None of this is necessarily how a modern integrated desktop like Gnome or KDE handles icons for their own programs. There are probably toolkit-specific protocols involved, and I suspect that there is more support and encouragement for SVG icons than there is in EWMH (where there is none).
PS: All of this is going to change drastically in Wayland, since we obviously won't have X properties any more.
(This whole exploration was prompted by a recent question on the FVWM mailing list.)
|
|