awesomeWM/awesome

Misleading documentation: awful.util.geticonpath

Open

#3646 aperta il 29 giu 2022

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)Lua (620 fork)batch import
good first issue

Metriche repository

Star
 (6882 star)
Metriche merge PR
 (Merge medio 37g 2h) (1 PR mergiata in 30 g)

Descrizione

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.

Guida contributor