fix(build): fix missing icon in the dock/dash of Linux DEs#6303
fix(build): fix missing icon in the dock/dash of Linux DEs#6303mikelei8291 wants to merge 1 commit into
Conversation
The missing `StartupWMClass` property in the .desktop file is causing the app icon not displaying on the dock/dash of Linux desktop environments.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds the StartupWMClass property to the generated Linux .desktop file in the Debian package creation task to improve window matching. Feedback suggests replacing dots with hyphens in the launcher class name (e.g., changing org.jackhuang.hmcl.Launcher to org-jackhuang-hmcl-Launcher) because Java GUI applications on Linux use hyphens for their window manager class, which is necessary for the desktop environment to correctly associate the application icon.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| Keywords=mc;minecraft; | ||
| """.formatted(getCurrentType().getDisplayName(), getLauncherPath(), getIconTargetPath()); | ||
| StartupWMClass=%s | ||
| """.formatted(getCurrentType().getDisplayName(), getLauncherPath(), getIconTargetPath(), getLauncherClassName().get()); |
There was a problem hiding this comment.
In Java AWT/Swing/JavaFX on Linux, the default WM_CLASS of the window is generated by taking the fully qualified name of the main class and replacing dots ('.') with hyphens ('-'). Therefore, for org.jackhuang.hmcl.Launcher, the actual window's WM_CLASS will be org-jackhuang-hmcl-Launcher. If the .desktop file specifies StartupWMClass=org.jackhuang.hmcl.Launcher (with dots), the desktop environment will fail to match the running window with the .desktop file, and the application icon will still not display correctly on the dock/dash (or a duplicate generic icon will appear). To fix this, we should replace dots with hyphens in the StartupWMClass value.
| """.formatted(getCurrentType().getDisplayName(), getLauncherPath(), getIconTargetPath(), getLauncherClassName().get()); | |
| """.formatted(getCurrentType().getDisplayName(), getLauncherPath(), getIconTargetPath(), getLauncherClassName().get().replace('.', '-')); |
The missing
StartupWMClassproperty in the .desktop file is causing the app icon not displaying on the dock/dash of Linux desktop environments.I'm not sure if there was a better way to retrieve the class name of the
Launcherclass than setting it as a property in thebuild.gradle.ktsfile with a literal string. If you happen to know how to retrieve the class name programmatically, feel free to tell me how to do it and I'll update the PR accordingly. Thank you.