sabato 18 luglio 2015

How to make your Qt application icon appear on Wayland task managers

Several months ago I was redesigning the Hawaii launcher.

Now Green Island offers a class called ApplicationManager that emits signals when an application is registered or unregister (that is when a window of a certain class first appears or when the last one is closed).  This class is also exposed by a Wayland protocol for shells that are running in another process.

Soon I noticed that for some applications the launcher panel didn't show an icon and I realized there was something wrong with the app_id (also known as the class in wl_shell_surface).

The class name identifies the general class of applications and can be used by a task manager to know which desktop entry contains application information.

Unfortunately this is not as easy as it sounds because there is no way to tell that automatically.
So back in the day I had to set the class name to the executable name as you can see here.
This approach worked almost always because desktop entries were usually named after the executable.

However things changed recently, as a matter of fact desktop file names now follow the reverse DNS convention while executables keep being called like before.

This is now achieved by QtWayland with this commit reversing the QCoreApplication::organizationDomain property and appending the executable name. If the property is not set, QtWayland falls back to the old behavior.

The patch is available on Qt 5.4.2 and 5.5.0.

TL;DR: Rename your desktop files using the reverse DNS convention and set the organizationDomain properly.
Posta un commento