Bug 500571 - Different Eclipse versions should set more specific WM_CLASS
Summary: Different Eclipse versions should set more specific WM_CLASS
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Linux
: P3 enhancement with 5 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2016-08-31 07:04 EDT by Alessio Gaeta CLA
Modified: 2023-04-14 04:34 EDT (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alessio Gaeta CLA 2016-08-31 07:04:19 EDT
Hello.

Currently, all Eclipse versions (running in Linux) have the same WM_CLASS. This prevents Gnome (and any XDG-compliant application based DE) to correctly group windows if different Eclipse versions are executed at the same time.

Until Luna, I found a workaround [1], but from Mars on (installed with Oomph) I don't know how to solve the problem (and I'm no more willing to...).

It would be great if each Eclipse version had a specific WM_CLASS (i.e. "Eclipse Neon"). And it would be even better if the WM_CLASS were specific to Oomph created instance! That way one could have a .desktop shortcut for each installation (and Oomph could even create the shortcut by itself...).

Thank you for your amazing work.

[1] I shared it here: http://askubuntu.com/a/741940/293463
Comment 1 Steffen Brummer CLA 2018-10-31 11:19:33 EDT
After upgrading to Ubuntu 18.04 with Gnome3 Dash it is also a problem for me.

I have two installations of Eclipse: CDT and PDT, each with nice looking icons on the dash.
But when executed they both registers as WM_Class "Eclipse" and show a new ugly icon on the dash.

I tried adding "StartupWMClass=Eclipse" to the eclipse .desktop files, but then they both registers under the first icon on the dash.
Fine solution if I only had one instance.

So I also would like if the WM_Class would reflect both the Eclipse release (Oxygen, Photon...) and if it has a CDT or PDT packages installed.

Because of the flexible nature of Eclipse perhaps a manual entry of the WM_CLASS would be preferable. A Simple config entry or support for the --class runtime parameter.
Comment 2 Eric Williams CLA 2018-10-31 16:09:02 EDT
SWT is separate from things like PDT/CDT or Eclipse versions, as it's a toolkit that can be used to write GUI applications completely unrelated to Eclipse. 

This makes it difficult to introduce such Eclipse IDE specific functionality into SWT.
Comment 3 Steffen Brummer CLA 2018-11-01 02:20:16 EDT
Well it must be possible since "xprop WM_CLASS" reports "Eclipse", "Eclipse".

Somehow I damaged my Eclipse Photon PDT installation yesterday, like it forgot its product name, and then suddenly its WM_CLASS was reported as "SWT".
A reinstall fixed it though.

I read some hints about changing the AppName property in a plugin.xml file, but there were several files with that name. So I tried to change "Eclipse" to "EclipsePDT" in several places and somehow I damaged it completely.

That is why I think it should be possible to override the WM_CLASS value via a configuration setting or in the ini file.
Comment 4 Cristiano Gaviao CLA 2019-01-29 11:55:48 EST
see Bug 494735
Comment 5 Steffen Brummer CLA 2019-01-29 13:00:26 EST
Some time ago my changes to the appName property in the plugin.xml files was suddenly reported via the xprop lookup. I guess something was fixed during an update.

So here is a summary of my solution:

I have two eclipse installations (simple downloads) in separate directories, eclipse-cpp (cdt) and eclipse-php (pdt).

In both installations I changed to appName property in the respective plugin.xml files:

plugins/org.eclipse.epp.package.cpp_4.8.0.20180619-1200/plugin.xml value=EclipseCDT

plugins/org.eclipse.epp.package.php_4.8.0.20180619-1200/plugin.xml value=EclipsePDT

The add the two desktop files:

In /usr/share/applications/eclipse-php.desktop:

[Desktop Entry]
Version=1.0
Name=Eclipse PHP
Comment=Eclipse with PDT
Exec=/opt/eclipse-php/eclipse
Icon=/opt/eclipse-install/eclipse-php.svg
StartupNotify=true
Terminal=false
Type=Application
Categories=TextEditor;IDE;Development;
StartupWMClass=EclipsePDT


In /usr/share/applications/eclipse-cpp.desktop:

[Desktop Entry]
Version=1.0
Name=Eclipse C++
Comment=Eclipse with CDT
Exec=/opt/eclipse-cpp/eclipse
Icon=/opt/eclipse-install/eclipse-cpp.svg
StartupNotify=true
Terminal=false
Type=Application
Categories=TextEditor;IDE;Development;
StartupWMClass=EclipseCDT

This gives me two nice icons on the gnome3 toolbar, with correctly placed indicators when the applications is started.
Comment 6 Cristiano Gaviao CLA 2019-01-30 10:36:46 EST
(In reply to Steffen Brummer from comment #5)
Great discover Steffen! thanks !

I did something similar for my IDEs installed with Eclipse Installer.
Since I have only one IDE for each profile it worked well. But it only worked for new installations. I need to delete the old ones and reinstall them.

So I changed the files at:

/home/user/.p2/pool/plugins/org.eclipse.epp.package.java_4.11.0.20190117-1900/plugin.xml 

/home/use/.p2/pool/plugins/org.eclipse.epp.package.cpp_4.11.0.20190117-1900/plugin.xml

and all others.
Comment 7 Simon Arlott CLA 2019-09-14 10:14:44 EDT
If Eclipse has already been started then it is necessary to delete configuration/org.eclipse.core.runtime/.mainData.1 to load the new appName value.
Comment 8 Steffen Brummer CLA 2023-04-14 04:34:59 EDT
It seems as of version 2023-03 (4.27.0) the above appName change is no longer working to set the WM_CLASS identifier.

It could be because I'm using Wayland, but I think I would have experienced problems sooner. The Wayland looking glass (Alt+F2 -> lg<enter> -> windows) shows wmclass: eclipse

If anybody know of a solution or why it no longer works please add a comment here.