emersion / mako

A lightweight Wayland notification daemon
https://wayland.emersion.fr/mako
MIT License
2.15k stars 136 forks source link

Scalable icons are not used #383

Open alkar opened 2 years ago

alkar commented 2 years ago

In my mako config I have:

icon-path=/usr/share/icons/elementary

When I send a notification with "newsboat" as the icon, it doesn't show any icons, although I have the following in my filesystem:

/usr/share/icons/hicolor/scalable/apps/newsboat.svg

If I supply the full path, it works, of course.

Reading through the code I believe that icons in the scalable folder are going to be ignored completely because this will produce an error and will cause the loop to move on to the next icon found.

I wonder if it would make sense for icons found in the scalable folder to take precedence over others (since they should be able to scale to any desired size) or at least, be accepted as appropriate as soon as the loop finds one.

emersion commented 2 years ago

We should lookup icons according to the spec: https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

alkar commented 2 years ago

Given that,

man 5 mako mentions:

       /usr/share/icons/hicolor and /usr/share/pixmaps are always searched.

And the spec mentions:

The lookup inside a theme is done in three phases. First all the directories are scanned for an exact match, e.g. one where the allowed size of the icon files match what was looked up. Then all the directories are scanned for any icon that matches the name. If that fails we finally fall back on unthemed icons. If we fail to find any icon at all it is up to the application to pick a good fallback, as the correct choice depends on the context.

And on my system I only have a single "newsboat" icon:

$ find /usr/share/icons/ -name '*newsboat*'
/usr/share/icons/hicolor/scalable/apps/newsboat.svg

Would it be unreasonable to expect mako to select it, eventually?

I'll need to read the pseudocode in the spec a bit more carefully and compare to the mako implementation but at a glance it looks like it's not doing the second pass (also see this comment).

vilhalmer commented 2 years ago

I can confirm that the current implementation is not anywhere near complete, it probably needs to be redone by someone who has more than one icon theme installed. -_-;

jmcantrell commented 11 months ago

I'm not 100% sure this is related, but I'm seeing something similar. In the Adwaita icon set, there's a symbolic/devices/drive-removable-media-symbolic.svg and scalable/devices/drive-removable-media.svg. I have the Adwaita directory added to icon-path and mako recognizes the symbolic version, but not the scalable one.

githubkuyaya commented 7 months ago

Can confirm, I tried to set it to the BeautyLine or the candy-icons theme, both of which only have scalable icons afaik. The icons do not get applied. The icons work with dunst, but on the other hand only mako supports transparency/opacity on wayland.