-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set WM_CLASS to org-jabref-JabRefMain #3273
Conversation
Hm, I appreciate this 👍 , but I will think it will backfire to us with java 9 or later , because we are effectively accessing internal Apis (for sure jdeps will complain), but as we still have do to this for the accent problem on linux I think it's worth. And I see no alternative. Another thing I found is the following: I do not fully understand the discussion and the resulting code change. But what I understand is that they added a property`/method to the c++ code which sets this gtk stuff in javafx. |
@@ -156,6 +157,16 @@ public static void init() { | |||
GUIGlobals.currentFont = new Font(Globals.prefs.get(JabRefPreferences.FONT_FAMILY), | |||
Globals.prefs.getInt(JabRefPreferences.FONT_STYLE), Globals.prefs.getInt(JabRefPreferences.FONT_SIZE)); | |||
|
|||
// Set WM_CLASS using reflection for certain Un*x window managers | |||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we should only execute this code, if we are actually running on a unix system, right? That means it should all be wrapped in an if (OS.LINUX)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would also exclude Unix systems like FreeBSD, wouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In all my time in the JabRef team, I've never heard of someone running it on FreeBSD. Anyway, the alternative solution is !OS.WINDOWS && !OS.OSX
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added that alternative variant now. Thanks for your review!
According to the above link, for JavaFX it should suffice to call |
It seems to me like this should happen automatically when the application is launched. But for some reason this is either not happening or the name is set to java-lang-Thread instead. I will try to find out what is going on here... |
Here are some new results:
This leaves the big question: Why does my window manager still show "java-lang-Thread" as WM_CLASS? In case this is only an issue on specific Linux systems, here are information about mine:
|
That is indeed mysterious: I can confirm this with Xfce, however in the Task Manager under Xfce it's correctly displayed
|
Thanks for investigating this. I suppose the problem is again that we are mixing JavaFX and Swing. I'm fine with the |
WM_CLASS is used by certain Un*x window managers, such as GNOME, to map windows to the corresponding application. Currently WM_CLASS is set to java-lang-Thread which is very generic and not unique to JabRef. Instead, use reflection to set it to org-jabref-JabRefMain which resembles the main class name.
be9d337
to
e89f949
Compare
WM_CLASS is used by certain Un*x window managers, such as GNOME, to map windows
to the corresponding application. Currently WM_CLASS is set to java-lang-Thread
which is very generic and not unique to JabRef. Instead, use reflection to set
it to org-jabref-JabRefMain which resembles the main class name.
The implementation in this PR is based on this blog post:
http://elliotth.blogspot.de/2007/02/fixing-wmclass-for-your-java.html
By now you find similar solutions in several Java applications. I'm not aware of a more convenient way to manually set WM_CLASS.
I tested the change on a Linux system running GNOME 3 and also on macOS to rule out any cross-platform issues. Also I chose the WM_CLASS name that matches the StartupWMClass in buildres/snapcraft/jabref.desktop, so no changes are necessary in there.
gradle localizationUpdate
?