Dash: add support for X11 PixMap .xpm application icons
Feature summary
Hi, I use CERN ROOT framework to develop GUI applications for Linux. There is an issue with Gnome Dash not displaying application PixMap icon compiled into the executable. Instead of the actual icon, a default "application-x-executable" icon is displayed on the Dash. Please refer to the screenshot below:
How would you like it to work
The .XPM icon specified in the source code of the application (example here) needs to be reflected on the GNOME Dock.
I tested my applications and ensured that the icon is displayed correctly in the Plank dock and Elementary OS dock, which uses fork of Plank. Please refer to the screenshot of my application with Plank dock running in GNOME:
Relevant links, screenshots, screencasts etc.
A PixMap icon is a 2-dimensional C++ char array that gets compiled into an executable. In order to set the applciation's icon I call the TGX11::SetIconPixmap()
function specified in the C++ code of the ROOT framework. Eventually the icon is passed to the native X11's XSetWMHints(Display*, Window, XWMHints*)
function as a icon_pixmap
member of the XWMHints
struct.
typedef struct {
...
Pixmap icon_pixmap; /* pixmap to be used as icon */
...
} XWMHints;
I did not look at the GNOME code. But to my understanding, the issue is following:
- GNOME requests window hints from the executable via X11's
XGetClassHint()
andXGetWMIconName()
functions. - If above methods do not provide any information about the icon name or if icon with the given name is not installed on the system, Dash falls back to default "application-x-executable" icon.
Solution may be following. Before falling back to the default icon, shell should additionally look up application's PixMap icon. It can be retrieved by calling the X11 function XGetWMHints()
that returns XWMHints::icon_pixmap
struct containing the missing icon.