Skip to content

Commit 7034f37

Browse files
committed
[wf-dock] improved icon search.
1 parent fe91f18 commit 7034f37

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/dock/toplevel-icon.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,16 @@ namespace IconProvider
256256
* send a single app-id, but in any case this works fine */
257257
while (stream >> app_id)
258258
{
259+
std::string app_name = app_id.substr(
260+
app_id.rfind(".")+1, app_id.size()
261+
);
262+
259263
/* Try first method: custom icon file provided by the user */
260-
if (set_custom_icon(image, app_id, size, scale))
264+
if (
265+
set_custom_icon(image, app_id, size, scale)
266+
||
267+
set_custom_icon(image, app_name, size, scale)
268+
)
261269
{
262270
found_icon = true;
263271
break;
@@ -267,11 +275,16 @@ namespace IconProvider
267275
auto icon = get_from_desktop_app_info(app_id);
268276
std::string icon_name = "unknown";
269277

278+
if (!icon)
279+
icon = get_from_desktop_app_info(app_name);
280+
270281
if (!icon)
271282
{
272283
/* Finally try directly looking up the icon, if it exists */
273284
if (Gtk::IconTheme::get_default()->lookup_icon(app_id, 24))
274285
icon_name = app_id;
286+
else if (Gtk::IconTheme::get_default()->lookup_icon(app_name, 24))
287+
icon_name = app_name;
275288
} else
276289
{
277290
icon_name = icon->to_string();

0 commit comments

Comments
 (0)