Nemo WM_CLASS='nemo' while it's desktop name prop='Files', but hey at least I can match by id

This commit is contained in:
Ksaper 2023-02-16 03:19:05 +02:00
parent 530619c848
commit 8530b17099
1 changed files with 11 additions and 8 deletions

View File

@ -90,18 +90,21 @@ function _icon_theme.get_client_icon_path(client, icon_theme, icon_size)
local desktop_app_info = DesktopAppInfo.new(id) local desktop_app_info = DesktopAppInfo.new(id)
if desktop_app_info then if desktop_app_info then
local props = { local props = {
string.lower(desktop_app_info:get_string("Name") or ""), id:gsub(".desktop", ""),
string.lower(desktop_app_info:get_filename() or ""), desktop_app_info:get_string("Name"),
string.lower(desktop_app_info:get_startup_wm_class() or ""), desktop_app_info:get_filename(),
string.lower(desktop_app_info:get_string("Icon") or ""), desktop_app_info:get_startup_wm_class(),
string.lower(desktop_app_info:get_string("Exec") or ""), desktop_app_info:get_string("Icon"),
string.lower(desktop_app_info:get_string("Keywords") or "") desktop_app_info:get_string("Exec"),
desktop_app_info:get_string("Keywords")
} }
for _, prop in ipairs(props) do for _, prop in ipairs(props) do
if prop ~= "" and (prop == class or prop == name) then if prop ~= nil and (prop:lower() == class or prop:lower() == name) then
local icon = desktop_app_info:get_string("Icon") local icon = desktop_app_info:get_string("Icon")
return _icon_theme.get_icon_path(icon, icon_theme, icon_size) if icon ~= nil then
return _icon_theme.get_icon_path(icon, icon_theme, icon_size)
end
end end
end end
end end