awesomeWM/awesome

Misleading documentation: awful.util.geticonpath

Open

#3,646 建立於 2022年6月29日

在 GitHub 查看
 (4 留言) (0 反應) (0 負責人)Lua (620 fork)batch import
good first issue

倉庫指標

Star
 (6,882 star)
PR 合併指標
 (平均合併 37天 2小時) (30 天內合併 1 個 PR)

描述

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.

貢獻者指南