diff --git a/lib/menubar/utils.lua.in b/lib/menubar/utils.lua.in index 8cd0b1690..0da1b8245 100644 --- a/lib/menubar/utils.lua.in +++ b/lib/menubar/utils.lua.in @@ -11,6 +11,7 @@ local ipairs = ipairs local string = string local awful_util = require("awful.util") local theme = require("beautiful") +local glib = require("lgi").GLib -- Utility module for menubar -- menubar.utils @@ -80,12 +81,15 @@ function utils.lookup_icon(icon_file) local icon_path = {} local icon_theme_paths = {} local icon_theme = theme.icon_theme - if icon_theme then - table.insert(icon_theme_paths, '/usr/share/icons/' .. icon_theme .. '/') - -- TODO also look in parent icon themes, as in freedesktop.org specification + local paths = glib.get_system_data_dirs() + table.insert(paths,1,glib.get_user_data_dir()) + table.insert(paths,1,glib.get_home_dir() .. '/.icons') + for k,dir in ipairs(paths)do + if icon_theme then + table.insert(icon_theme_paths, dir..'/icons/' .. icon_theme .. '/') + end + table.insert(icon_theme_paths, dir..'/icons/hicolor/') -- fallback theme end - table.insert(icon_theme_paths, '/usr/share/icons/hicolor/') -- fallback theme - for i, icon_theme_directory in ipairs(icon_theme_paths) do for j, size in ipairs(all_icon_sizes) do table.insert(icon_path, icon_theme_directory .. size .. '/apps/') @@ -96,10 +100,11 @@ function utils.lookup_icon(icon_file) table.insert(icon_path, icon_theme_directory .. size .. '/status/') end end - -- lowest priority fallbacks - table.insert(icon_path, '/usr/share/pixmaps/') - table.insert(icon_path, '/usr/share/icons/') - + for k,dir in ipairs(paths)do + -- lowest priority fallbacks + table.insert(icon_path, dir..'/pixmaps/') + table.insert(icon_path, dir..'/icons/') + end for i, directory in ipairs(icon_path) do if is_format_supported(icon_file) and awful_util.file_readable(directory .. icon_file) then return directory .. icon_file