From 29d8f365f81273b7ad6fcc6af41ca2cd7c579044 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 19 Apr 2019 17:30:40 +0200 Subject: [PATCH] refactor(Tray): proper lookup in the default theme --- src/modules/sni/item.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/modules/sni/item.cpp b/src/modules/sni/item.cpp index 19cde58a..601f8356 100644 --- a/src/modules/sni/item.cpp +++ b/src/modules/sni/item.cpp @@ -265,15 +265,16 @@ Glib::RefPtr waybar::modules::SNI::Item::getIconByName(std::string if (tmp_size == 0) { tmp_size = request_size; } - auto icon = - icon_theme->load_icon(name.c_str(), tmp_size, Gtk::IconLookupFlags::ICON_LOOKUP_FORCE_SIZE); - if (!icon) { - Glib::RefPtr default_theme = Gtk::IconTheme::get_default(); - default_theme->rescan_if_needed(); - return default_theme->load_icon( + if (!icon_theme_path.empty() && + icon_theme->lookup_icon( + name.c_str(), tmp_size, Gtk::IconLookupFlags::ICON_LOOKUP_FORCE_SIZE)) { + return icon_theme->load_icon( name.c_str(), tmp_size, Gtk::IconLookupFlags::ICON_LOOKUP_FORCE_SIZE); } - return icon; + Glib::RefPtr default_theme = Gtk::IconTheme::get_default(); + default_theme->rescan_if_needed(); + return default_theme->load_icon( + name.c_str(), tmp_size, Gtk::IconLookupFlags::ICON_LOOKUP_FORCE_SIZE); } void waybar::modules::SNI::Item::onMenuDestroyed(Item* self) {