Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Desktop.lua icon defaults do not work #23

Open
rjhwelsh opened this issue Aug 29, 2021 · 3 comments
Open

Desktop.lua icon defaults do not work #23

rjhwelsh opened this issue Aug 29, 2021 · 3 comments

Comments

@rjhwelsh
Copy link

Hi,

I noticed there is an issue with the default desktop icons (using the adwaita theme) on awesome v4.3.

I traced it back to menubar.utils.lua

Since the introduction of Menubar as core library for providing Freedesktop.org menu functionalities in Awesome, we can now avoid all the dirty work by just exploiting menubar.utils functions.

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

...

You might not notice right away, but it only adds icons in the "apps" and "categories" directories to the search path.
All the others are ignored.

As a workaround I re-wrote utils.lua section to :

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

So now it takes mimetypes, places and legacy as places to search also.

I'm not convinced it is an issue with menubar, because I believe apps and categories are the relevant sections for that app.
So I just wanted to document it here, in-case others have issues with the icons and they don't have to figure it out.

I might pose a generic icon search interface as a feature request to the AwesomeWM croud later.

So, there's some dirty work for you. ;)

@lcpz
Copy link
Owner

lcpz commented Aug 29, 2021

As a workaround I re-wrote utils.lua section to :

Create a new pull request, fixing menubar won't be done anytime soon, thus we can keep this workaround for the time being.

@rjhwelsh
Copy link
Author

rjhwelsh commented Aug 29, 2021 via email

@lcpz
Copy link
Owner

lcpz commented Aug 29, 2021

Is there any way in Lua to change an internal function of another module?

I think you can do something quick and inelegant like this:

local utils = require("menubar.utils")
function utils.get_icon_lookup_path()
    -- hic sunt dracones
end

But I trust you can come up with an ingenious solution (aka feel free to do the dirty work for me 🤪).

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

No branches or pull requests

2 participants