Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support special icon size subfolders 24@2x #1401

Open
W4RH4WK opened this issue Nov 28, 2024 · 5 comments
Open

Support special icon size subfolders 24@2x #1401

W4RH4WK opened this issue Nov 28, 2024 · 5 comments

Comments

@W4RH4WK
Copy link

W4RH4WK commented Nov 28, 2024

Issue description

Certain themes (e.g. breeze-dark) organize their icons in subfolders denoting the icon's size.
However, sometimes they use un-intuitive names for these subfolders (or symlinks).

$ ls -l /usr/share/icons/breeze-dark/status
total 108
drwxr-xr-x 2 root root 20480 Nov 13 19:33 16
drwxr-xr-x 2 root root 45056 Nov 13 19:33 22
drwxr-xr-x 2 root root 28672 Nov 13 19:33 24
lrwxrwxrwx 1 root root     2 Nov  8 16:25 24@2x -> 24
lrwxrwxrwx 1 root root     2 Nov  8 16:25 24@3x -> 24
drwxr-xr-x 2 root root 12288 Nov 13 19:33 32
drwxr-xr-x 2 root root  4096 Nov 13 19:33 64

I don't know why they use 24@2x instead of 48.
This icon theme provides SVG files.

Nevertheless, dunst does not pick up these icons using:

enable_recursive_icon_lookup = true
icon_theme = "breeze-dark"
min_icon_size = 48
max_icon_size = 48

If I manually create a symlink 48 -> 24, the icons are picked up correctly.

I'd like dunst to support folder names like 24@2x as well in order to support such icon themes out-of-the-box.

Alternatively, we should talk to icon theme vendors to provide additional symlinks (like the one I created for testing).

Edit: additional information here

Edit 2: This could actually be an issue with the specific theme I am using.
I've opened an issue upstream and will update this one accordingly.

Installation info

  • Version: Dunst - A customizable and lightweight notification-daemon 1.11.0 (2024-04-15)
  • Install type: Pacman
  • Window manager / Desktop environment: Wayland + River
  • Distro: Arch
@bynect
Copy link
Member

bynect commented Nov 28, 2024

Hello, thanks for pointing this out. I will try to look into it since we already have some issues with icon sizes.

Also, maybe 24@2x is intended for 24 icons when the scale is 2x?

@W4RH4WK
Copy link
Author

W4RH4WK commented Nov 28, 2024

The index.theme file features sections relating to these folders.
The sections typically have a size and scale field.

[actions/24@2x]
Size=24
Scale=2
Context=Actions
Type=Fixed

The spec says this about scale:

On very high density (high dpi) screens the UI is often scaled to avoid the UI being so small it is hard to see. In order to support this icons can have a target scale, describing what scale factor they are designed for.
For instance, an icon with a directory size of 48 but scale 2x would be 96x96 pixels, but designed to have the same level of detail as a 48x48 icon at scale 1x. This can be used on high density displays where a 48x48 icon would be too small (or ugly upscaled) and a normal 96x96 icon would have a lot of detail that is hard to see.

https://specifications.freedesktop.org/icon-theme-spec/latest/#definitions

To me, this suggests that the main purpose of these icons is for high DPI; but I don't see why they couldn't be used as fallback (e.g. using 24@2x when 48x48 is required and no "native" 48x48 icon is present).

Given breeze-dark's index.theme could be wrong, I'd wait for clarification from the KDE crew.
After that I could take a peek into how the icon lookup is initialized and used.

@W4RH4WK
Copy link
Author

W4RH4WK commented Nov 28, 2024

This case should already be covered by tests:

find_icon_test("edit", 64, "32x32", "actions", "edit.png");

[32x32@2x/actions]
Size=32
Scale=2
Type=Fixed

Although, I'd assume the expected path to start with 32x32@2x ?!

@bynect
Copy link
Member

bynect commented Nov 28, 2024

We might as well add a 24x24 test case.

But I think right now the scale factor is somehow ignored when searching

@W4RH4WK
Copy link
Author

W4RH4WK commented Nov 28, 2024

But I think right now the scale factor is somehow ignored when searching

https://specifications.freedesktop.org/icon-theme-spec/latest/#icon_lookup contains a pseudo code section explaining how icon lookup could/should be implemented.

The relevant part for the scale property is found in DirectorySizeDistance.
The overall selection algorithm is a bit more complicated than what dunst uses currently.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants