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

wf-dock: try to find icons for snap apps #274

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
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
21 changes: 21 additions & 0 deletions src/dock/toplevel-icon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,19 @@ Icon get_from_desktop_app_info(std::string app_id)
"/usr/share/applications/",
"/usr/share/applications/kde/",
"/usr/share/applications/org.kde.",
"/usr/share/applications/org.gnome.",
"/usr/local/share/applications/",
"/usr/local/share/applications/org.kde.",
"/usr/local/share/applications/org.gnome.",
};

std::vector<std::string> app_id_variations = {
app_id,
tolower(app_id),
tolower(app_id),
};
// e.g. org.gnome.Evince.desktop
app_id_variations[2][0] = std::toupper(app_id_variations[2][0]);

std::vector<std::string> suffixes = {
"",
Expand All @@ -268,6 +273,22 @@ Icon get_from_desktop_app_info(std::string app_id)
}
}

if (!app_info)
{
// special treatment for snap apps
std::string prefix = "/var/lib/snapd/desktop/applications/";
auto& id = app_id_variations[1]; // seems to be lower case
for (auto& suffix : suffixes)
{
app_info = Gio::DesktopAppInfo::create_from_filename(
prefix + id + "_" + id + suffix);
if (app_info)
{
break;
}
}
}

if (app_info) // success
{
return app_info->get_icon();
Expand Down
Loading