Repository: godot
Issue: With Wayland enabled Godot windows often show the wrong icon in Alt+Tab switcher in GNOME
Labels: bug,platform:linuxbsd,topic:porting

### Tested versions

Reproducible: v4.3.beta1.official [a4f2ea91a]

Not Reproducible: 4.2.2-stable

### System information

Godot v4.3.beta1 - Fedora Linux 40 (Workstation Edition) - Wayland - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3050 Laptop GPU () - AMD Ryzen 9 6900HS Creator Edition (16 Threads)

### Issue description

On build 4.3-beta1, with the option 'Editor Settings > Run > Platforms > Prefer Wayland' enabled, Godot windows often show the wrong icon in the Alt+TAB switcher. The GNOME default icon for an app without an icon configured will be shown.

This affects both the Project Manager window & the Godot Editor window.

While troubleshooting this I noticed that the appplication identifier for Godot windows often shows ```<untracked>``` when viewed with [GNOME's Looking Glass tool](https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/a6d35fdd2abd63d23c7a9d093645f760691539a0/docs/lookingGlass.md) for examining window metadata.

On 4.2.2 the window metadata shown in Looking Glass for the Godot Editor will consistently read the following, resulting in icons working correctly
``` 
wmclass: Godot
app: org.godotengine.Godot.desktop
```

On 4.3.3.beta1 the values frequently show

```
wmclass: org.godotengine.Godot.Editor
app: <untracked>
```

But occasionally, 4.3.3.beta1 will show the same values as 4.2.2 shown above. When that occurs the icons display normally. It's unclear why these values are not consistent across executions on 4.3.3.beta1

With 'Prefer Wayland' disabled, this doesn't occur.  On 4.2.2-stable this doesn't occur, the icons appear normally (the Wayland option is not available on that version). The icon in the GNOME Shell 'Show Apps' view appears correctly, only the Alt+Tab switcher shows the broken icon.

I'm using the .desktop file included in the Godot repo, and the icon.png file saved as ~/.local/shared/icons/hicolor/256x256/apps/godot.png

As mentioned above this issue doesn't happen 100% of the time on 4.3.3.beta1 w/Wayland. Repro rate is 4/5 launches. Occasionally the icons will be correct and the Looking Glass tool values will be the same as on 4.2.2.stable

### Steps to reproduce

1. Download Godot 4.3.beta1
2. Extract & copy the binary to any folder (I put it in ~/tools/godot/)
3. Create a symlink called 'godot' in ~/.local/bin to the executable path from Step 2
4. Download the Godot .desktop file from https://github.com/godotengine/godot/blob/master/misc/dist/linux/org.godotengine.Godot.desktop
5. Copy the .desktop file to ~/.local/share/applications
6. Download the icon.png file from https://github.com/godotengine/godot/blob/master/icon.png
7. Copy the icon file to ~/.local/share/icons/hicolor/256x256/apps/ & rename it to godot.png
8. Launch Godot
9. Alt+TAB with Project Manager open. Examine Godot icon
10. From Godot Project Manager, open any project to launch Godot Editor.
11. Alt+TAB wit Godot Editor open. Examine Godot icon
12. Press Alt+F2 to open the GNOME Run dialog. Type 'lg' and press ENTER to launch the Looking Glass tool
13. Click the 'Windows' button in the upper right of the Looking Glass tool to get a list of open windows
14. Examine 'wmclass' and 'app' fields for Godot windows.


Screenshots below show (in order):
- 4.3.3.beta1 with the wrong switcher icon
- 4.3.3.beta1 with the 'bad' window metadata shown in Looking Glass
- 4.3.3.beta1 with the same metadata as 4.2.2.stable shown in Looking Glass. Resulting in working icons. No changes to config, just a different execution. Both launched using the .desktop file.

![4 3 3 beta1-alt-tab-switcher](https://github.com/godotengine/godot/assets/61667827/5fdd4fda-6e96-42ff-996a-e635d83457ed)
![4 3 3 beta1-app-untracked](https://github.com/godotengine/godot/assets/61667827/5134956e-ec26-4f40-b1c2-3ce8304eeeb8)
![4 3 3 beta1-same-metadata-as-4 2 2](https://github.com/godotengine/godot/assets/61667827/c4d254a1-5481-471c-8894-89e4b13c70c5)


### Minimal reproduction project (MRP)

N/A