godotengine / godotengine/godot
When running in Wayland, taskbar and window icons do not use Godot icon because Godot does not use a consistent `app_id` throughout its execution
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Reproducible in v4.3.stable.official [77dcf97d8], v4.3.rc1.official [e343dbbcc]
### System information
Gentoo Linux, KDE Plasma 5.27.11, Wayland graphics platform
### Issue description
Wayland maps a window to an application by matching the application's `app_id` to a matching `.desktop` file in `/usr/share/applications` or `~/.local/share/applications/`. The `.desktop` file included in the Godot source is `misc/dist/linux/org.godotengine.Godot.desktop`, meaning that once that file is properly copied to the appropriate directories Wayland will only be able to match the window to the application when the app_id is exactly `org.godotengine.Godot`.
The `.desktop` files appropriately placed in the application directories is also what allows application menus to automatically populate all the applications installed in the system.
In `platform/linuxbsd/wayland/display_server_wayland.cpp`, function `DisplayServerWayland::_get_app_id_from_context`, Godot sets a different app_id based on the context it is running in: `org.godotengine.Editor`, `org.godotengine.ProjectManager`, `org.godotengine.Godot`, or the value set in `application/config/name`.
Consequently the taskbar and window frame show the default Wayland app icon instead of the Godot icon.
The value set in `application/config/name` would of course be the user's responsibility to have a `.desktop` file appropriate for their own game, so that is not an issue for this bug, although may require some documentation changes to note the connection between the `application/config/name` and the user’s own generated and distributed `.desktop` file.
### Steps to reproduce
Enable the Prefer Wayland option in the editor settings.
Copy the file `misc/dist/linux/org.godotengine.Godot.desktop` to either `/usr/share/applications` or `~/.local/share/applications/`
Run Godot, opens in ProjectManager context with the app_id org.godotengine.ProjectManager.
Open a project, Godot reloads with the app_id org.godotengine.Editor
In both of these contexts, the taskbar and window decoration icons use the default Wayland icon.
### Minimal reproduction project (MRP)
N/A
Contributor guide
Assessment
This issue has not been assessed yet.