mojira.dev
MC-141690

The Minecraft window's WM_CLASS should be stable across Minecraft versions

As described in the comments of MC-30900, Minecraft sets its WM_CLASS on Linux to the same as the title, e.g. "Minecraft 1.13.2". This makes it impossible to use tools that use simple string comparison on the window class to manage Minecraft windows.

The window class should be set to just "Minecraft".

Comments 5

This happens also in Windows, I think using a regex is better that depending on the exact title for looking up the windows, plus its useful while giving support for users to have a quick way to check what version they are running(just look up the title)

have a quick way to check what version they are running(just look up the title)

Sure, the title can stay as it is, but on Linux the title and "window class" are separate, and the class shouldn't contain the version – it doesn't for any other program that I know of.

Ah, then this should probably go in the launcher project instead

Hey,

I just ran into the same issue, and here is what I found:

mrmeszaros@debella ~> xprop WM_CLASS WM_NAME
WM_CLASS(STRING) = "Minecraft 1.13.2", "Minecraft 1.13.2"
WM_NAME(STRING) = "Minecraft 1.13.2"

mrmeszaros@debella ~> xprop WM_CLASS WM_NAME
WM_CLASS: not found.
WM_NAME(STRING) = "Minecraft Launcher"

A solution would be for the Launcher and Minecraft having the same WM_CLASS (window manager class) and different names.
Eg.:

WM_CLASS = "Minecraft" or "minecraft"

Do I understand correctly that the issue has to be solved in the Launcher (although it affects MC too)?

This is still an issue as of version 1.18.1, WM_CLASS includes the version, so it's impossible to identify Minecraft windows realiably as versions change.

This is what xprop gives me on Linux:

_NET_WM_ICON_NAME(UTF8_STRING) = "Minecraft 1.18.1"
_NET_WM_NAME(UTF8_STRING) = "Minecraft 1.18.1"
WM_LOCALE_NAME(STRING) = "en_US.UTF-8"
WM_ICON_NAME(STRING) = "Minecraft 1.18.1"
WM_NAME(STRING) = "Minecraft 1.18.1"
WM_CLASS(STRING) = "Minecraft 1.18.1", "Minecraft 1.18.1"

I'd expect WM_CLASS to be just "Minecraft" or "minecraft".

@violine1101 this is not a duplicate of MCL-10365, so I wouldn't consider it resolved

Thanks

J

(Unassigned)

Unconfirmed

Minecraft 1.13.2

Retrieved