menubar.icon_theme.lookup_icon: check for dist in outer loop

This commit is contained in:
Daniel Hahler 2015-10-12 01:01:04 +02:00
parent 75341d9e38
commit 7d9b78c13c
1 changed files with 12 additions and 10 deletions

View File

@ -168,16 +168,18 @@ local lookup_icon = function(self, icon_name, icon_size)
local minimal_size = 0xffffffff -- Any large number will do. local minimal_size = 0xffffffff -- Any large number will do.
local closest_filename = nil local closest_filename = nil
for _, subdir in ipairs(self.index_theme:get_subdirectories()) do for _, subdir in ipairs(self.index_theme:get_subdirectories()) do
for _, basedir in ipairs(self.base_directories) do local dist = directory_size_distance(self, subdir, icon_size)
for _, ext in ipairs(self.extensions) do if dist < minimal_size then
local filename = string.format("%s/%s/%s/%s.%s", for _, basedir in ipairs(self.base_directories) do
basedir, self.icon_theme_name, subdir, for _, ext in ipairs(self.extensions) do
icon_name, ext) local filename = string.format("%s/%s/%s/%s.%s",
if not checked_already[filename] then basedir, self.icon_theme_name, subdir,
local dist = directory_size_distance(self, subdir, icon_size) icon_name, ext)
if awful.util.file_readable(filename) and dist < minimal_size then if not checked_already[filename] then
closest_filename = filename if awful.util.file_readable(filename) then
minimal_size = dist closest_filename = filename
minimal_size = dist
end
end end
end end
end end