Gnome: App icon showing in launcher, but not in dash

Hi, my first post here. Hope I posted in the right forum.

Anyway, my issue is I created a snap for my flutter application, using core22.

All works well except the icons in Gnome. Launcher displays the correct icon.

However the app in dash displays default system icon (screenshot attached). I installed the app locally using the “–dangerous” option.


I have since released the app, but the icon in launcher is still default. Any Ideas?

I ran into icon issues with my app while testing on multiple desktops (not just Gnome). Desktop stuff can be quite difficult to make consistent, but I eventually got my app to display its icon consistently. I no longer have the source documentation I used, so I can only point you to code.

Assuming you already have Icon set in the .desktop file, try also setting StartupWMClass to the app’s name in the .desktop file. For example: StartupWMClass=Trackself

You’ll also need to make sure your app sets the wmclass attribute to the same name, plus a few other steps. For example, a GTK app using Python/PyGObject/GLib could do the following on startup:

  1. In the main Gtk.Window constructor/initializer:
# Must match StartupWMClass in .desktop (mainly for xorg). Use 'xprop' cmd to verify on a xorg-based desktop.
self.set_wmclass('Trackself', 'Trackself')
self.set_default_icon(my_app_icon_pixbuf)  # needed for desktops like KDE
  1. Plus a couple of GLib calls somewhere at the start of main():
GLib.set_prgname('Trackself')  # must match StartupWMClass in .desktop (mainly for wayland)

I realize my examples are not in flutter, but hopefully they can send you in the right direction.

For the record and any souls that come looking for answers after me.

I managed to solve the issue.

The answer is:

  if (g_file_test("assets", G_FILE_TEST_IS_DIR)) {
    gtk_window_set_icon_from_file(window, "assets/img/icon.png", NULL); // For debug mode
  } else {
    gtk_window_set_icon_from_file(window, (getExecutablePath() + "/data/flutter_assets/assets/img/icon.png").c_str(), NULL); // For launcher mode

Sourced from:

Note that the solution from the github comment does not work because the relative path for the image is wrong, due to the way shells work.

So I solved that by crafting an absolute path. Which is the following function (source attributed).

static std::string getExecutablePath() {
  // code taken from
  std::string fullFileName = "";
  std::string path = "";
  pid_t pid = getpid();
  char buf[20] = {0};
  std::string _link = "/proc/";
  _link.append( buf );
  _link.append( "/exe");
  char proc[512];
  int ch = readlink(_link.c_str(),proc,512);
  if (ch != -1) {
    proc[ch] = 0;
    path = proc;
    std::string::size_type t = path.find_last_of("/");
    path = path.substr(0,t);

  fullFileName = path + std::string("/");
  return fullFileName;
1 Like