Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notifications: Try to guess app id if getting from hints fails #479

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/lib/notification.vala
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,27 @@
category = variant.get_string();
}

// Set the application ID and app info
// Try to set the application ID and app info
if ((variant = hints.lookup("desktop-entry")) != null && variant.is_of_type(VariantType.STRING)) {
app_id = variant.get_string();
app_id.replace(".desktop", "");
app_info = new DesktopAppInfo("%s.desktop".printf(app_id));
}

// Because following specs is a lost art, sometimes the desktop-entry
// value does not correspond to the desktop file. So, try to best-guess
// the desktop id instead.
if (app_info == null) {
app_id = app_name.replace(" ", "-").down();
app_info = new DesktopAppInfo("%s.desktop".printf(app_id));
}

if (app_info != null) app_name = app_info.get_string("Name") ?? app_name;
// Make sure we have the best app name
if (app_info != null) {
app_name = app_info.get_string("Name") ?? app_name;
}

// Try to get the application's image
app_image = get_appinfo_image(Gtk.IconSize.DND, app_id.down());

bool image_found = false;
Expand Down Expand Up @@ -272,4 +284,4 @@
return null;
}
}
}
}