awesomeWM / awesome

awesome window manager
https://awesomewm.org/
GNU General Public License v2.0
6.31k stars 596 forks source link

Menubar doesn't show all Numix(-Circle) icons due to special directory names #1675

Open hexchain opened 7 years ago

hexchain commented 7 years ago

Output of awesome --version:

awesome v4.1 (Technologic) • Compiled against Lua 5.3.4 (running with Lua 5.3) • D-Bus support: ✔ • execinfo support: ✔ • xcb-randr version: 1.5 • LGI version: 0.9.1

How to reproduce the issue:

  1. Install Numix(-Circle) icon and use it in theme.lua
  2. Open menubar

Actual result:

No icon if .desktop does not specify one.

Expected result:

Menubar items are shown with correct icon.

By poking around in lib/menubar I guess awesome does not support unnormal size names for directory. A hardcoded table limits all possible directory names but Numix project uses special ones:

~ $ tree -L 2 /usr/share/icons/Numix-Circle/
/usr/share/icons/Numix-Circle/
├── 16
│   └── panel -> ../../Numix/16/panel
├── 16@2x -> 16
├── 22
│   └── panel -> ../../Numix/22/panel
├── 22@2x -> 22
├── 24
│   └── panel -> ../../Numix/24/panel
├── 24@2x -> 24
├── 48
│   └── apps
├── 48@2x -> 48
├── icon-theme.cache
└── index.theme

12 directories, 2 files

Actually there are code for index.theme parsing (and per Icon Theme Specification the correct way to find icon in a theme is to read that index file for possible paths), but it seems not used for application icons, only for category icons.

Manually adding 16, 22, 24 and 48 to all_icon_sizes table makes it work as expected but that's probably not the right solution.

Veratil commented 7 years ago

For now your manually added strings is the best solution I think. That's actually using the utils icon lookup (one of the three in the codebase).

menubar is in need of a rewrite anyway; it's on the todo list. Handling unorthodox directory names is a good thing to watch out for though.

rjhwelsh commented 3 years ago

I noticed that menubar/utils.lua only searches for particular icon types; apps and categories. Presumably these are only icons that are fit for an application menu?

I think perhaps this bug should be turned into a feature request for generic icon search interface.

local function get_icon_lookup_path()

...

 local app_in_theme_paths = {}
    for _, icon_theme_directory in ipairs(icon_theme_paths) do
        for _, size in ipairs(all_icon_sizes) do
            table.insert(app_in_theme_paths,
                         glib.build_filenamev({ icon_theme_directory,
                                                size, 'apps' }))
            table.insert(app_in_theme_paths,
                         glib.build_filenamev({ icon_theme_directory,
                                                size, 'categories' }))
        end
    end

...

My related issue and a slight workaround is here.

actionless commented 2 years ago

i have smth similar in my local config:

https://github.com/actionless/awesome_config/blob/638a7af35ae5ddc6f6a60587717894cf10571b5e/actionless/util/xdg.lua#L54