Fix Icon Finding in awful.util

This should also fix naughty failures to display the correct icons
This commit is contained in:
Gino! 2014-04-11 17:09:10 -04:00
parent 302aabea3a
commit b4b6e6c1fc
1 changed files with 12 additions and 9 deletions

View File

@ -185,21 +185,24 @@ end
-- of the dirs are searched first
function util.geticonpath(iconname, exts, dirs, size)
exts = exts or { 'png', 'gif' }
dirs = dirs or { '/usr/share/pixmaps/' }
dirs = dirs or { '/usr/share/pixmaps/', '/usr/share/icons/hicolor/' }
icontypes = { 'apps', 'actions', 'categories', 'emblems',
'mimetypes', 'status', 'devices', 'extras', 'places', 'stock' }
for _, d in pairs(dirs) do
for _, e in pairs(exts) do
local icon
if size then
icon = string.format("%s%ux%u/%s.%s",
d, size, size, iconname, e)
if util.file_readable(icon) then
return icon
end
end
for _, e in pairs(exts) do
icon = d .. iconname .. '.' .. e
if util.file_readable(icon) then
return icon
end
if size then
for _, t in pairs(icontypes) do
icon = string.format("%s%ux%u/%s/%s.%s", d, size, size, t, iconname, e)
if util.file_readable(icon) then
return icon
end
end
end
end
end
end