Taskbar icon for GLFW program (Gnome 3.38.3, Ubuntu 20.10)

Hello, if I make a simple gtkmm app it will start with a blank/tranparent icon in the Taskbar. But I can set the Taskbar icon by creating a Desktop entry (/home/erik/.local/share/applications/test.desktop). However, if I make a simple GLFW app and a similar Desktop entry, the icon remains blank/transparent.

How can I set the Taskbar icon for a GLFW app?

Here is a screenshot of the Taskbar with a proper icon for my gtkmm app and the blank/transparent icon for my GLFW app.

OS Name: Ubuntu Linux 20.10
OS Type: 64 bit
GNOME Version 3.38.3
Windowing system: X11
GLFW Version: 3.3

PS. I have also tried to use glfwSetWindowIcon() which internally calls XChangeProperty(_glfw.x11.display, window->x11.handle, _glfw.x11.NET_WM_ICON, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) icon, longCount); but that has no effect.

I found the problem: A desktop entry must have proper StartupWMClass. (The first entry you get if you run your application, and then from a terminal run xprop WM_CLASS and click on your application window.)

In my gtkmm test app I did nothing to set the WM_CLASS which meant that the WM_CLASS automatically got the same name as the executable, and it seems like in that case you don’t need to set the StartupWMClass in the Desktop entry.

However, in GLFW the WM_CLASS will be set by the third argument in the glfwCreateWindow() which is the Window title, and then the StartupWMClass must be correctly set in the Desktop entry.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.