Fixing generic Wayland icons on task bar/alt tab

Some applications on Linux using Wayland display a generic icon instead of their real one. This can be frustrating when switching between applications using the taskbar or Alt-Tab.

For me, these applications were Obsidian and Sublime Merge.

Alt Tab

The fix (when using KDE) consists of adding a new KWin rule. To do this, follow these steps:

1. Access Window Rules

Go to “System Settings > Window Management > Window Rules”.

2. Create a New Rule (If None Exist)

If the application does not have any rules already, create a new one:

  • Click on “Add New…”
  • Add a description (e.g., “Application settings for sublime_merge”)
  • Specify the “Window class (application)”

If you’re unsure of the value for the window class, click “Detect Window Properties”, then click on the application window. A pop-up with the detected properties will be shown, and you can select the correct value.

3. Add Property

Click on “Add Property” and select “Desktop File Name”.

4. Find the Correct Desktop File Name

  • Standard Applications: If the application is installed using your distro’s repositories, check the name in /usr/share/applications/.
  • Flatpak Applications: If it’s a Flatpak package, check the name in /var/lib/flatpak/exports/share/applications/. For example, for Obsidian, it will be md.obsidian.Obsidian (do not include the .desktop suffix).

Alt Tab

5. Apply Settings

Apply the new settings and close the application if it was open. The next time you open the application, it should show the correct icon.

Alt Tab Fixed