This a specific example of a generic problem I haven't been able to find a solution for yet.
I have a program (Android Virtual Device Manager) that launches 'sub-programs' (namely emulators or virtual devices) from within itself (also can be launched from else where). I want any instances of EITHER of these programs to be grouped under the same Unity icon.
I have created a
.desktop file to try and accomplish this but don't exactly know how to go about it. The desktop file is as follows:
#!/usr/bin/env xdg-open [Desktop Entry] Version=1.0 Type=Application Terminal=false Name=Android Virtual Device Icon=/home/ben/.icons/android.svg Exec=/home/ben/usr/bin/android avd StartupWMClass=Android Virtual Device Manager
From what I understand,
StartupWMClass is what I need to set to achieve this correctly. I have obtained the two class names ('Android Virtual Device Manager' and 'emulator64-arm') using
xprop WM_CLASS on the repsective windows. Both work individually (the launcher icon is correctly attached to the program no matter what way it is launched), but I cannot get it to work for both.
I am assuming that I somehow need to set two values for
StartupWMClass but have not been able to do it correctly (or know if it is a valid operation). I have tried, colon separated like environment variables, comma separated, quotes, etc and I cannot find any hints in the official documentation.
Another, more pedantic, but probably more identifiable example is with
Matlab. I am running 2013a and the splash screen that initially shows and the program have completely different
WM_CLASS values. This means, when I click my launcher with
StartupWMClass=com-mathworks-util-PostVMInitben in it, the splash screen comes up with a different (default Unknown)
Unity icon, while the rest comes up grouped under my launcher.
xprop WMCLASS and clicking on first the splash screen, then repeating with an active
Matlab session I get the following terminal output:
ben@ben-OptiPlex-9010:~$ xprop WM_CLASS WM_CLASS(STRING) = "MATLAB", "MATLAB" ben@ben-OptiPlex-9010:~$ xprop WM_CLASS WM_CLASS(STRING) = "sun-awt-X11-XFramePeer", "com-mathworks-util-PostVMInit"
If I could specify something along the lines of:
That would work perfectly (as both work separately) but I have no idea of the syntax, if it even exists. I just know nothing I have tried has worked thus far.
Any help or a definitive answer either way would be great as I believe this is a pretty fundamental element of a well functioning desktop.