Fix Icon Finding in awful.util
This should also fix naughty failures to display the correct icons
This commit is contained in:
parent
302aabea3a
commit
b4b6e6c1fc
|
@ -185,21 +185,24 @@ end
|
||||||
-- of the dirs are searched first
|
-- of the dirs are searched first
|
||||||
function util.geticonpath(iconname, exts, dirs, size)
|
function util.geticonpath(iconname, exts, dirs, size)
|
||||||
exts = exts or { 'png', 'gif' }
|
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 _, d in pairs(dirs) do
|
||||||
|
local icon
|
||||||
for _, e in pairs(exts) 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
|
|
||||||
icon = d .. iconname .. '.' .. e
|
icon = d .. iconname .. '.' .. e
|
||||||
if util.file_readable(icon) then
|
if util.file_readable(icon) then
|
||||||
return icon
|
return icon
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue