Merge pull request #761 from Anakael/pr/anakael/taskbar-icons

Change find icon priority and to_lower for app_id
This commit is contained in:
Alex 2020-07-01 23:17:44 +02:00 committed by GitHub
commit 7d9217b14a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,6 +77,7 @@ static bool image_load_icon(Gtk::Image& image, Glib::RefPtr<Gtk::IconTheme> icon
const std::string &app_id_list, int size) const std::string &app_id_list, int size)
{ {
std::string app_id; std::string app_id;
std::string lower_app_id;
std::istringstream stream(app_id_list); std::istringstream stream(app_id_list);
bool found = false; bool found = false;
@ -85,9 +86,19 @@ static bool image_load_icon(Gtk::Image& image, Glib::RefPtr<Gtk::IconTheme> icon
* send a single app-id, but in any case this works fine */ * send a single app-id, but in any case this works fine */
while (stream >> app_id) while (stream >> app_id)
{ {
std::string icon_name = get_from_desktop_app_info(app_id); std::string icon_name = get_from_icon_theme(icon_theme, app_id);
if (icon_name.empty()) {
lower_app_id = app_id;
std::transform(lower_app_id.begin(), lower_app_id.end(), lower_app_id.begin(),
[](char c){ return std::tolower(c); });
icon_name = get_from_icon_theme(icon_theme, lower_app_id);
}
if (icon_name.empty()) if (icon_name.empty())
icon_name = get_from_icon_theme(icon_theme, app_id); icon_name = get_from_desktop_app_info(app_id);
if (icon_name.empty())
icon_name = get_from_desktop_app_info(lower_app_id);
if (icon_name.empty()) if (icon_name.empty())
continue; continue;