mojira.dev

Scott Zeid

Assigned

No issues.

Reported

No issues.

Comments

LWJGL 2.9.1, which supports setting the WM_CLASS hint as I mentioned above, was released on Monday. LWJGL now sets the WM_CLASS hint to the window's title automatically, but it does allow WM_CLASS to be set to something else via the LWJGL_WM_CLASS System property. Since Minecraft now sets the window title to "Minecraft <version>" (which is useful for users who use more than one game version), WM_CLASS should be set to just "Minecraft" so that people don't have to update their .desktop launchers or window manager settings with every release. This needs to be done before Display.create() is called:

System.setProperty(System.getProperty("LWJGL_WM_CLASS", "Minecraft"));

This will use the existing value of LWJGL_WM_CLASS if there is one (e.g. if the user wants to use a different WM_CLASS; maybe they have different .desktop files that use different working directories or something).

Also, the launcher should use "Minecraft" as its WM_CLASS. Since the launcher is using AWT, the only way I know of to do this is this trick that uses reflection. For me, GNOME Shell recognizes the launcher because its process ID is the same as the process GNOME spawned when picking the launcher icon, but since the game runs in a separate process, it doesn't recognize it unless its WM_CLASS is set properly. Still, the launcher's WM_CLASS should be set properly because I imagine it could be a problem for users of other desktop environments. (I imagine that if the launcher is launched with -DLWJGL_WM_CLASS=..., then that should be used for the launcher and also passed to the game before the user flags (allowing it to be overridden just for the game).)

LWJGL has just added support for setting the WM_CLASS hint, and it will be available in LWJGL 2.9.1. In the meantime, I've made this to set up one of the LWJGL nightlies in the launcher.