awesomeWM/awesome

Misleading documentation: awful.util.geticonpath

Open

#3,646 opened on Jun 29, 2022

View on GitHub
 (4 comments) (0 reactions) (0 assignees)Lua (6,882 stars) (620 forks)batch import
good first issue

Description

From Doc: https://awesomewm.org/doc/api/libraries/awful.util.html#geticonpath From Code: https://github.com/awesomeWM/awesome/blob/54a5a7dce580da39152175f2668463c7751d904c/lib/awful/util.lua

size : The size. If this is specified, subdirectories x of the dirs are searched first. (optional)

This imply (if my english is correct), that when the size argument is specified, it will search inside dirs/x first and then other directories.

as an example:

awful.util.geticonpath('my-icon', { 'svg', 'png' }, { '/usr/share/icons/hicolor/' }, '22')

Expected (let's fix the x as sizexsize): Find my icons wherever it is inside /usr/share/icons/hicolor/ but prioritize the /usr/share/icons/hicolor/22x22/ folder to get the correct size if it exist.

Searching first inside the dirs/sizexsize directory

  • search for /usr/share/icons/hicolor/22x22/my-icon.svg
  • search for /usr/share/icons/hicolor/22x22/my-icon.png

then search other directories

  • search for /usr/share/icons/hicolor/my-icon.svg
  • search for /usr/share/icons/hicolor/my-icon.png
  • search for /usr/share/icons/hicolor/*/my-icon.svg
  • search for /usr/share/icons/hicolor/*/my-icon.png

What is really happening: Only search /usr/share/icons/hicolor/ and /usr/share/icons/hicolor/22x22/ with no priority to the correct size.

I won't add the icontypes steps to simplify

  • search for /usr/share/icons/hicolor/my-icon.svg
  • search for /usr/share/icons/hicolor/22x22/my-icon.svg
  • search for /usr/share/icons/hicolor/my-icon.png
  • search for /usr/share/icons/hicolor/22x22/my-icon.png

And no fall back to other size directories.

Possible fix (of the doc), remove the order of search in the descriptions (as it's actually complicated to explain it), actually write sizexsize and not just x.

size : The size. If this is specified, will also search subdirectory sizexsize of the dirs. (optional)

PS: I would be ok to learn to do a PR / contribute, if you agree about it.

Contributor guide