Welcome to my blog where I write mostly about technical things!

How to Fix Faulty Spotify Icon in KDE Plasma Application Switch

Whether I installed the app image or the Flatpack version of Spotify, I always had issues with the app icon in the window's title bar and the application switch. It fell back to a defaulting x11 icon.

A screenshot showing an application switch with three open apps system settings, Spotify and Firefox. The icon of the Spotify entry is highlighted and wrong. Only the label Spotify gives away that it is the app. The icon is the X11 fallback icon.
A screenshot showing the title bar of Spotify. The title bar features the wrong icon. It's the icon of X11.
After investigating, it turned out that it's relatively easy to fix. All you need is a simple KWin rule. You don't even need to set any properties with it (at least, I have observed so far). It just needs to be there. For the sake of “better safe than sorry”, we add a meaningful property anyway.
Open up “Window Rules” in the “System Settings”. Add a new rule and give it a meaningful description. Something like “Spotify” should do the trick. Then add spotify (lowercase is essential!) as the Window Class. Afterward, click “Add Property” and choose “Desktop file name”. Add spotify-client as the value and select the mode Force.
A screenshot showing the Window Rules dialog with the settings as described in the paragraph above.
That's it already! Applying the changes should fix the icon.
A screenshot showing the title bar of Spotify and an application switch. Both icons are now correctly displaying the official Spotify app image.