Use PyXDG.IconTheme to lookup the application icons instead of pyGTK;
this has some advantages:
- we are already using PyXDG, so it does not add new requirements
- the icon lookup follows the icon theme specs a little bit closer
- the icon lookup does not require an X/graphical session
- there is no implicit 'adwaita' or 'gnome' icon theme used in lookup
there are also few disadvantages:
- there is no concept of "default icon theme", so "hicolor" is hardcoded
for now; note that, when using pyGTK, the "default icon theme" was the
GTK one, not any other configured in other ways
- it seems the lookup logic for hicolor returns the smallest icon
available in case the current size is not available: for example a
16px PNG is returned instead of a 48px for a requested and not found
64px size
Python 2 went EOL almost 1 year and half ago, and Python 2 bits are
tested less and less. Even more, Python 3 has been available for years
before that.
Hence, drop the support for Python 2, and assume Python 3 instead.
This is what freedektop says about it:
"The location of the desktop file as either a URI (if for example
gotten from the vfolder system) or a local filename or empty if no
location is known."
I have never seen this in the wild, but still it might exist somewhere.
This is what freedesktop says about it:
"The Icon key of the desktop entry expanded as two arguments, first
--icon and then the value of the Icon key. Should not expand to any
arguments if the Icon key is empty or missing. "
some KDE apps have this "-caption %c" in a few variations. %c is "The
translated name of the application as listed in the appropriate Name key
in the desktop entry" according to freedesktop. All apps launch without a
problem without it as far as I can tell, so it's better to remove it than
have to deal with extra sets of nested quotes which behave differently in
each WM. This is not 100% failure-proof. There might be other variations
of this out there, but we can't account for every single one. If someone
finds one another one, I can always add it later.
In addition to other icon file types, also detect svgz icons. Do not
use them in any case, since none of the supported WMs can use them.
Also, make the extension detection case-insensitive. I've never seen an
icon extension with capitals in the wild, but who knows...
Finally, clean up the code a bit, so it reads easier.
When an svg icon is provided with a full path in the .desktop file,
strip the extension and path and look it up just as if only the icon
name was given.