Demystifying StartupWMClass

https://thoughts.greyh.at/posts/startup-wm-class/

As the maintainer of Plank Reloaded, the most common bug report I get is "this app has the wrong icon." It's almost never the dock - it's a broken StartupWMClass in the app's .desktop file. So I wrote up how to find the right value on X11, Wayland, and KDE, and why deleting the line often fixes it.

90 points · 15 comments · view on lemmy.world

15 Comments

angel@sopuli.xyz · 11 pts · 60d (8 replies)

I use Firefox nightly and recently switched to Wayland (KDE). Ever since I switched, the taskbar often displays Firefox nightly with the regular Firefox icon, and the name Firefox instead of Firefox nightly. After reading your blog post I'm thinking that the culprit could be an incorrect StartupWMClass. But I don't get why this issue never showed on X11 then.

zquestz@lemmy.world · 7 pts · 60d (7 replies)

Yeah something isn't being matched right. Might want to look at both .desktop files and compare them. Probably be pretty obvious when you look. =)

angel@sopuli.xyz · 5 pts · 60d (6 replies)

I just checked the .desktop file for firefox nightly. It contains only firefox-nightly as its StartupWMClass. So I went ahead and also checked the window class firefox nightly is running as and found the following: Screenshot showing the window properties of firefox nightly in the KDE system settings

Does this mean that firefox nightly is using both, the firefox and the firefox-nightly window classes?

zquestz@lemmy.world · 1 pts · 60d (5 replies)

Yep it has both applied. What are the actual .desktop file names?

angel@sopuli.xyz · 2 pts · 60d (4 replies)

The desktop files are named firefox.desktop and firefox-nightly.desktop, both in /usr/share/applications.

EDIT: For completeness, I also checked the window classes of the regular firefox: Screenshot of the KDE system settings displaying properties of the normal non-nightly firefox window

It can be observed that it uses only the window class firefox, but twice?

zquestz@lemmy.world · 1 pts · 60d (3 replies)

Yeah in your case the best fix is probably REMOVING StartupWMClass from those launchers if it is present. Then it will only match the app id on the .desktop file name.

angel@sopuli.xyz · 1 pts · 60d (2 replies)

Hmm, but I thought the StartupWMClasses in the desktop files are correct? I thought the issue is that firefox-nightly uses the firefox class in addition to the firefox-nightly class

zquestz@lemmy.world · 2 pts · 60d

StartupWMClass is NOT needed if the .desktop file is named correctly.

ButteredBread@sh.itjust.works · 6 pts · 60d (2 replies)
[ removed ]
zquestz@lemmy.world · 16 pts · 60d (1 reply)

I actually use that logo for my app menu.

ButteredBread@sh.itjust.works · 9 pts · 60d
[ removed ]
RichardNixos@lemmy.ml · 2 pts · 59d

One thing I've noticed that's funny is that sometimes when I use waypipe to launch a remote app locally it will have a random-ass icon, like a steam game or something

MonkderVierte@lemmy.zip · 1 pts · 60d (1 reply)
StartupWMClass=

I've never seen this line in a .desktop. What is it for?

Crogdor@lemmy.world · 8 pts · 60d

This is literally what the article was created to explain. Just one more click, my guy, you’re almost there.

deadcream@sopuli.xyz · -8 pts · 60d (1 reply)

I wrote up

I don't think you did.

zquestz@lemmy.world · 15 pts · 60d

You can think whatever you want.