sardemff7/libnkutils

nk_xdg_theme_get_icon cannot find icon

ikrivosheev opened this issue · 1 comments

Hello, I use on my laptop rofi as application launcher. This project uses your library for search path to icon. I installed application https://zoom.us/ and rofi does not show icon.
Zoom.desktop:

[Desktop Entry]
Name=Zoom
Comment=Zoom Video Conference
Exec=/usr/bin/zoom %U
Icon=Zoom.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Network;Application;
StartupWMClass=Zoom
MimeType=x-scheme-handler/zoommtg;x-scheme-handler/zoomus;x-scheme-handler/tel;x-scheme-handler/callto;x-scheme-handler/zoomphonecall;application/x-zoom
X-KDE-Protocols=zoommtg;zoomus;tel;callto;zoomphonecall;
Name[en_US]=Zoom

I read specification and cannot found specification for field: Icon, but found an algorithm to icon lookup.

I understand that desktop file is not correct for this algorithm, but other application launcher show icon for this desktop file. Maybe is better add empty extension here and after this fix application with extension in icon path will work?

The lookup algorithm is correct, with the exception of splitting on dash (-) as specified in the Icon naming spec that I learned about recently (and I’ll fix that at some point).

I’ll elaborate a bit on the real issue here, for reference.
The specification for Desktop files is to be found here and the Icon filed is documented as following:

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

And from xdg-desktop-icon --manual:

Icon=Icon File
    The icon to use for the application. This can either be an absolute path to
    an image file or an icon-name. If an icon-name is provided an image lookup
    by name is done in the user's current icon theme. The xdg-icon-resource
    command can be used to install image files into icon themes. The advantage
    of using an icon-name instead of an absolute path is that with an icon-name
    the application icon can be provided in several different sizes as well as
    in several differently themed styles.

As I explained in davatorium/rofi#942.

I want to avoid this extra from the spec in libnkutils.

The real fix here is to fix Zoom Desktop file, they may be happy to fix it even.

As a workaround one could strip any extension when using the Desktop file, but that has to be done on rofi side, but workarounds never help specifications, IMO.
Or you could try to change the spec to include this usage, but that still would be the Desktop Entry specification, telling implementation to strip the extension. Or at least that’s how I would edit the spec if that was really needed.
But these files are usually from applications that don’t care about GNU/Linux enough to bother about specs at first, so just helping them getting it right is probably a good thing.