Fixing Generic Wayland Icons for Applications in KDE Plasma
If you run KDE Plasma on Wayland, you may have run into a small but persistent annoyance: some applications show up with a generic Wayland logo in the Alt-Tab switcher and the taskbar instead of their proper icon.
Why this happens
On Wayland, windows identify themselves to the compositor using an app_id. KWin tries to match this identifier against installed .desktop files to figure out which icon to display. The match is done against either:
- The
.desktopfile's base name (without the.desktopextension), or - The
StartupWMClass=field inside the file
If KWin can't find a match, you get the default Wayland logo as a fallback. This commonly happens when an application's .desktop file is named one thing (say, my-cool-app.desktop) but the binary reports a different app_id to the compositor (say, com.example.CoolApp). The two never meet, and you get a blank icon.
Step 1: Find out what your window actually reports
Focus the misbehaving window, then run this in a terminal:
qdbus org.kde.KWin /KWin queryWindowInfo
You'll get a block of output describing the currently active window. The important lines are desktopFile and resourceClass. For example:
desktopFile: jetbrains-idea
resourceClass: jetbrains-idea
resourceName: idea
The resourceClass value is what KWin uses to look up the icon. Note it down.
Step 2: Rename the .desktop file to match
Find the existing .desktop file for the application and rename it so its basename matches the resourceClass from step 1. Desktop files live in one of two places:
~/.local/share/applications/for user-installed entries/usr/share/applications/for system-wide entries
If the misbehaving file is system-wide, don't edit it in place — copy it to ~/.local/share/applications/ with the correct name instead. User-level files take precedence over system ones, so your renamed copy will win.
cp /usr/share/applications/wrong-name.desktop \
~/.local/share/applications/correct-name.desktop
Replace correct-name with whatever resourceClass you got from queryWindowInfo.
Step 3: Refresh the KDE cache
Plasma caches the desktop file database, so nudge it to pick up your new file:
kbuildsycoca6
Use kbuildsycoca5 if you're still on Plasma 5. Then restart the application and Alt-Tab away — the icon should now render correctly.