Ubuntu – StartupWMClass will not change WM_Class of Eclipse IDE

14.0415.04eclipsegnome

I am working with two different versions of Eclipse. Due to conflicts between the plugins I decided to install both of these versions separately, which works perfectly fine except one little issue. I am working with Ubuntu-Gnome (14.04 LTS) and I edited the .desktop file of one version like this:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Name=Custom Eclipse 
Icon=custom-icon
Path=/opt/custom-eclipse/
Exec=/opt/custom-eclipse/custom-eclipse
StartupNotify=true
StartupWMClass=custom-eclipse

Now, what bugs me is the following:

The application starts up with the custom name, WM_Class and icon as expected, yet, when the application has finished starting up these attributes change for some reason and it is grouped with the other eclipse installation by the gnome-shell.

If I enter xprop WM_CLASS in terminal and click on the window it returns WM_CLASS(STRING) = "Eclipse", "Eclipse".

edit:
I just recently switched from a Unity desktop to a GNOME shell and using Unity the windows were not grouped together.

another edit:
I updated my ubuntu version to 15.04 and my gnome-shell to 3.14.4 but unfortunately the problem remains. I am starting to think that this could only be fixed by editing the Eclipse source code…

Best Answer

  • StartupWMClass does not change the actual application window class, but only tells the desktop manager what window class should use to identify the application window(s).

    The problem is that Eclipse uses Eclipse as window class despite its version.

    If you want to use more than one Eclipse version at once and have windows grouped correctly, with the ability to pin the application icon as favorite, you should edit the plugin.xml of package you are using.

    For Eclipse Java EE IDE I succesfully edited the plugin.xml in

    <eclipse-root>/plugins/org.eclipse.epp.package.jee_<current-version>

    changing the properties

    plugin/extension/product/@name
    plugin/extension/product/property[@name=appName]/@value
    

    (not sure wich one is enough) to whatever value you prefer. The same value you should put in .desktop file as StartupWMClass.

  • Related Question