Deprecate menubar.icon_theme

The code in menubar.icon_theme naively implements the algorithm from the
base dir specification. This is a problem: On this system,
/usr/share/icons/{Adwaita,hicolor}/index.theme list 91, respectively 649
subdirectories. Since we check for three file extensions (png, svg,
xpm), this means that a failing icon lookup for the Adwaita theme checks
for (91+649)*3 = 2220 files (in practice it might be a bit better since
the directories have specific meanings, but still). That's insane.

Since we only use this code for looking up category icons anyway, just
deprecate this mess. Category icons are now looked up in the same way
that icons for individual applications are looked up.

Since menubar.init does not require("menubar.icon_theme"), this means
that menubar.icon_theme is no longer actually loaded. That's bad.

(Hopefully) Fixes: https://github.com/awesomeWM/awesome/issues/1496
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-11-16 13:12:59 +01:00
parent e20068cb4a
commit 0b0b466705
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,5 @@
---------------------------------------------------------------------------
--- Class module for icon lookup for menubar
--- (Deprecated) class module for icon lookup for menubar
--
-- @author Kazunobu Kuriyama
-- @copyright 2015 Kazunobu Kuriyama
@ -78,6 +78,7 @@ local icon_theme = { mt = {} }
local index_theme_cache = {}
--- Class constructor of `icon_theme`
-- @deprecated menubar.icon_theme.new
-- @tparam string icon_theme_name Internal name of icon theme
-- @tparam table base_directories Paths used for lookup
-- @treturn table An instance of the class `icon_theme`
@ -218,6 +219,7 @@ local lookup_fallback_icon = function(self, icon_name)
end
--- Look up an image file based on a given icon name and/or a preferable size.
-- @deprecated menubar.icon_theme:find_icon_path
-- @tparam string icon_name Icon name to be looked up
-- @tparam number icon_size Prefereable icon size
-- @treturn string Absolute path to the icon file, or nil if not found

View File

@ -10,7 +10,6 @@
local gtable = require("gears.table")
local gfilesystem = require("gears.filesystem")
local utils = require("menubar.utils")
local icon_theme = require("menubar.icon_theme")
local pairs = pairs
local ipairs = ipairs
local table = table
@ -59,7 +58,7 @@ menu_gen.all_categories = {
--- Find icons for category entries.
function menu_gen.lookup_category_icons()
for _, v in pairs(menu_gen.all_categories) do
v.icon = icon_theme():find_icon_path(v.icon_name)
v.icon = utils.lookup_icon(v.icon_name)
end
end