Bug 401029 - Task manager shows Hangouts with generic Chrome icon
Summary: Task manager shows Hangouts with generic Chrome icon
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Task Manager and Icons-Only Task Manager (show other bugs)
Version: 5.14.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: 1.0
Assignee: Eike Hein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-14 10:07 UTC by Jurica Vukadin
Modified: 2023-03-17 16:08 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch (1.79 KB, patch)
2018-11-14 12:34 UTC, Jurica Vukadin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jurica Vukadin 2018-11-14 10:07:10 UTC
Task manager (as well as Icon only task manager) always shows Hangouts with the generic Chrome icon. I tried adding the following rule for Chrome in /etc/xdg/taskmanagerrulesrc:

[Rewrite Rules][Google-chrome][1]
Property=ClassName
Identifier=StartupWMClass
Match=(?<=crx_)(?'match'[a-z]+)
Target=chrome-%1-default

I also have the following desktop file in .local/share/applications/, named chrome-nckgahadagoaajjgafhacjanaoiihapd-default.desktop:
[Desktop Entry]
Version=1.0
Terminal=false
Type=Application
Name=Google Hangouts
Icon=chrome-nckgahadagoaajjgafhacjanaoiihapd-default
NoDisplay=true
Exec=/opt/google/chrome/chrome
StartupWMClass=crx_nckgahadagoaajjgafhacjanaoiihapd

The icons are in:
.local/share/icons/hicolor/128x128/apps/chrome-nckgahadagoaajjgafhacjanaoiihapd-default.png
.local/share/icons/hicolor/48x48/apps/chrome-nckgahadagoaajjgafhacjanaoiihapd-default.png

And yet, both task managers always show the generic Chrome icon. If I set the NoDisplay property to false, I can see the launcher in the application menu (under the Lost&Found section) with the correct Hangouts icon.
Comment 1 Jurica Vukadin 2018-11-14 12:34:22 UTC
Created attachment 116305 [details]
Patch

Matching xWindowsWMClassName before appId fixes it for me. No need for rules in taskmanagerrulesrc either.
Comment 2 Eike Hein 2018-11-16 08:14:44 UTC
Kai: As the resident Chrome guy, can you look into this?
Comment 3 Jurica Vukadin 2018-11-16 09:38:01 UTC
The problem is that google-chrome.desktop as shipped has StartupWMClass=Google-chrome, so all Chrome windows always match on appId (i.e. XClassHint::res_class). xWindowsWMClassName (XClassHint::res_name) and rewrite rules are never even evaluated.

Shouldn't the xWindowsWMClassName be evaluated first, since it is more specific?
Comment 4 Eike Hein 2018-11-18 08:01:26 UTC
The idea is to identify applications, and the application id is what the second string in WM_CLASS (i.e. the "class" in ICCCM parlance) corresponds to. If this is to be Hangouts and not Google Chrome, then it should say so in that part of WM_CLASS. This is an opinionated take based on what most apps on the platform actually do - as in, if we change the order other things will break instead since a lot of apps end up putting random crap into the instance part of WM_CLASS. I've even seen window titles in there, and then your taskbar ends up resorting based on the website you're viewing, ... there's never an easy victory.

Chrome (and Chrome web apps in particular) is an app we end up somehow fixing at least once a year when they pull some new random foolhardery - it's high in my personal charts for most ill-behaved Linux desktop app.

The rewrite rules can swap instance for class, though, iirc.
Comment 5 Jurica Vukadin 2018-11-18 08:37:24 UTC
Okay, I added:

Google-chrome::crx_nckgahadagoaajjgafhacjanaoiihapd=chrome-nckgahadagoaajjgafhacjanaoiihapd-default.desktop

to the mapping section of taskmanagerrulesrc. This works, but now the taskbar ignores the icon set in the .desktop file and uses the one it pulled from the _NET_WM_ICON atom, which is unfortunately only 16x16 in size.
Comment 6 Jurica Vukadin 2018-11-18 09:00:07 UTC
Oh, I see, it wants file:// + the absolute path to the .desktop file.
Working fine now. Thanks for your support.
Comment 7 galder 2022-01-30 15:44:09 UTC
Looks like an old issue. Setting it to needs more info.
Please try with a newer version(plasma 5.23.5) and if this is not an issue any more let us know.Bugs placed into NEEDSINFO status will receive a reminder if the ticket:

    Is at least 15 days old
    Has not received any comment within 15 days

If a bug remains in NEEDSINFO for another 15 days with no comment, it will be closed as RESOLVED > WORKSFORME.
Comment 8 Jurica Vukadin 2022-01-30 16:52:30 UTC
Still present on 5.23.90. Let me know what further info is needed.
Comment 9 Fushan Wen 2023-03-17 16:08:09 UTC
Fixed in 5.27