Discussion:
Proposed change to desktop-entry-spec: make StartupWMClass a "string(s)" field
Andy
2015-01-20 18:05:05 UTC
Permalink
Hi,

Some applications make use of multiple windows of different types, with
different values for StartupWMClass. If the desktop entry spec supported a
semicolon-delimited list of values for the StartupWMClass field, then
libraries like bamf could make use of that information to better match
windows to applications.

The particular case which came up for me is with KDE's telepathy text UI,
which uses a different StartupWMClass for the contact list and the chat
windows, where the chat windows don't have an executable or desktop entry
of their own, but are really just a component of the same application
launched by the contact list desktop entry. I see the ideal solution as
adding

StartupWMClass=ktp-contactlist;ktp-text-ui;

to ktp-contactlist.desktop, but that syntax (multiple values) is not
supported by relevant libraries. I believe the first step toward that kind
of support would be an update to the spec legitimizing that syntax.

Thanks for reading,
Andy
Andy
2015-01-27 18:01:54 UTC
Permalink
Hi,

I'm just following up with some more use cases. The KDE System Settings can
be launched as a monolithic item, or alternatively each module can be
launched independently. The full application window's class is
"systemsettings" while the components' are "kcmshell4" -- both of these
should be grouped and matched with the System Settings .desktop file, so it
would be appropriate to set both window classes in the System Settings
.desktop file.

In looking for a solution to this StartupWMClass limitation, I came across
folks asking the same questions two years ago:
http://askubuntu.com/questions/248826/set-multiple-values-for-startupwmclass-to-group-under-same-launcher-in-unity

From that post:

'''
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. . . .
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
<http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html>.

. . .

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-PostVMInit in it,
the splash screen comes up with a different (default Unknown) Unity icon,
while the rest comes up grouped under my launcher. . . .

If I could specify something along the lines of:

StartupWMClass=com-mathworks-util-PostVMInit&&MATLAB

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.
'''

Someone responded 4 months later with:

'''
Same problem for me with Starcraft II launched throw playonlinux. There is
first a application launcher:

(WM_CLASS(STRING) = "Blizzard Launcher.exe", "Wine")

and then the game itself:

(WM_CLASS(STRING) = "SC2.exe", "Wine")
'''

So there are clearly cases where this would help, and the limitation has
been a known inconvenience for at least 2 years so far. Does anyone have a
reason not to go forward allowing multiple values for StartupWMClass?

Thanks for reading,
Andy
Jasper St. Pierre
2015-01-27 19:10:25 UTC
Permalink
Hi Andy,

StartupWMClass usage should be considered legacy. In order to compute a
mapping from window class to .desktop file, we need to read *all* files
from disk, which is super expensive to do first thing on boot.

I wouldn't be too happy modifying it so that we have to do *more* work to
make it work. I would rather work on a replacement so that we don't have to
do as much work to find a .desktop file from a window.

Adding a new X window property like _NET_WM_DESKTOP_ID would be more up my
alley, but I know Ryan isn't too happy with it, and is instead working on a
better proposal. CCing him to hear his current thoughts.
Post by Andy
Hi,
I'm just following up with some more use cases. The KDE System Settings
can be launched as a monolithic item, or alternatively each module can be
launched independently. The full application window's class is
"systemsettings" while the components' are "kcmshell4" -- both of these
should be grouped and matched with the System Settings .desktop file, so it
would be appropriate to set both window classes in the System Settings
.desktop file.
In looking for a solution to this StartupWMClass limitation, I came across
http://askubuntu.com/questions/248826/set-multiple-values-for-startupwmclass-to-group-under-same-launcher-in-unity
'''
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. . . .
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
<http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s05.html>.
. . .
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-PostVMInit in it,
the splash screen comes up with a different (default Unknown) Unity icon,
while the rest comes up grouped under my launcher. . . .
StartupWMClass=com-mathworks-util-PostVMInit&&MATLAB
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.
'''
'''
Same problem for me with Starcraft II launched throw playonlinux. There is
(WM_CLASS(STRING) = "Blizzard Launcher.exe", "Wine")
(WM_CLASS(STRING) = "SC2.exe", "Wine")
'''
So there are clearly cases where this would help, and the limitation has
been a known inconvenience for at least 2 years so far. Does anyone have a
reason not to go forward allowing multiple values for StartupWMClass?
Thanks for reading,
Andy
_______________________________________________
xdg mailing list
http://lists.freedesktop.org/mailman/listinfo/xdg
--
Jasper
David Faure
2015-02-25 17:44:18 UTC
Permalink
Post by Jasper St. Pierre
Hi Andy,
StartupWMClass usage should be considered legacy. In order to compute a
mapping from window class to .desktop file, we need to read *all* files
from disk, which is super expensive to do first thing on boot.
But the same is true when you want to find out which apps can handle a certain
mimetype, etc. This is why we have binary caches for .desktop files in various
implementations (and I'm still hoping we can get a standard one updated at
install time, which Ryan Lortie was working on a long time ago...)
--
David Faure, ***@kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5
Loading...