dunst
dunst copied to clipboard
Some icons can't be found
Issue description
Run notify-send --icon=nm-no-connection hgfhgfhgf
. This icon wont be found
Installation info
- Version:
1.9.0
- Install type:
Arch official package
- Window manager / Desktop environment:
BSPWM
Minimal dunstrc
[global]
width="(0, 1200)"
height=9999
enable_recursive_icon_lookup=yes
icon_theme=Papirus
max_icon_size=50
Try setting a specific icon_path
with the relative icon name and path root directory
Yeah, that works. For some reason, the recursive lookup algorithm is skipping the /usr/share/icons/Papirus/24x24/panel/
directory where this icon is contained unless I specify min_icon_size = 24
. This isn't ideal, though, because then all theme icons are 24x24 when enable_recursive_icon_lookup
is enabled.
The problem is the use of n->min_icon_size
here:
https://github.com/dunst-project/dunst/blob/dfab9f057f89702ade5725c8247a520ab51026f4/src/notification.c#L340
which, assuming recursive icon lookup is enabled, looks for icons with the given size:
https://github.com/dunst-project/dunst/blob/dfab9f057f89702ade5725c8247a520ab51026f4/src/icon.c#L217-L221
which then calls, in turn find_icon_in_theme_with_inherit
and find_icon_in_theme
, which only matches directories for exactly the given size, unless the icon directory is scalable[1] or scalable within a threshold[2]:
https://github.com/dunst-project/dunst/blob/dfab9f057f89702ade5725c8247a520ab51026f4/src/icon-lookup.c#L250-L263
I think the problem is that this part of the XDG spec isn't implemented:
As soon as there is an icon of any size that matches in a theme, the search is stopped. Even if there may be an icon with a size closer to the correct one in an inherited theme, we don't want to use it. Doing so may generate an inconsistant change in an icon when you change icon sizes (e.g. zoom in).
Dunst only looks for icons of exactly matching sizes, and doesn't fall back to other sizes.
So basically there are two problems:
- Using
min_icon_size
as the icon size [3] - Not looking up alternative sizes
The fix for 2 is obvious, just find the "best" sized icon when the exact match is not available as in the XDG spec.
Not sure what the proper fix to 1 would be: we could add an icon_size
option which is the size to prefer. min_icon_size
and max_icon_size
would remain to scale icons that are too small/big.
[1] Although Dunst doesn't seem to find scalable icons either, unless XDG_DATA_DIRS=/usr/local/share/:/usr/share/
is set manually...
[2] Not relevant here, but thresholds are actually supposed to be checked by offset, not by a factor:
if Type is Threshold
return Size - Threshold <= iconsize <= Size + Threshold
[3] Apparently using min_icon_size
as the icon size is intentional behaviour: https://github.com/dunst-project/dunst/issues/1094#issuecomment-1199799087.