Bug 376695 - StartupWMClass not honoured
Summary: StartupWMClass not honoured
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Icons-only Task Manager (show other bugs)
Version: 5.9.2
Platform: Other Linux
: NOR normal
Target Milestone: 1.0
Assignee: Eike Hein
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-02-20 05:19 UTC by Peter
Modified: 2017-02-22 08:57 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.9.3


Attachments
Google Photos app .desktop file (307 bytes, application/x-desktop)
2017-02-20 12:22 UTC, Peter
Details
Google Photos app xprop output (2.84 KB, text/plain)
2017-02-20 12:24 UTC, Peter
Details
Custom Plex Desktop Entry (304 bytes, application/x-desktop)
2017-02-21 12:19 UTC, Peter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter 2017-02-20 05:19:46 UTC
The icons-only task manager does not appear to honour the StartupWMClass in a .desktop spec file.

Example:
Chrome/Chromium app with .desktop file

Expected behaviour:
When launching the Chrome app, the active window should be associated with it's own 'icon'.  This is the behaviour in the Gnome dock and other docks such as Plank.

Actual behaviour:
When launching the Chrome app, the app icon 'disappears' immediately and it is grouped with other Chrome windows.
Comment 1 Kai Uwe Broulik 2017-02-20 09:12:02 UTC
Don't tell me Chrome *yet again* changed their window classes? We do have some mapping rules to match chrome/chromium app windows to their desktop file so they should be treated separately from actual chrome browser windows.

What chrome/chromium version is this? Can you provide your desktop file for your app and it's name (e.g. Default-blabla-chrome.desktop) as well as the output of xprop for the respective window (run xprop from terminal and click the Chromium app window).
Comment 2 Eike Hein 2017-02-20 09:56:21 UTC
Changing status to reflect Kai's comment.
Comment 3 Peter 2017-02-20 12:22:16 UTC
Created attachment 104123 [details]
Google Photos app .desktop file
Comment 4 Peter 2017-02-20 12:24:02 UTC
Created attachment 104124 [details]
Google Photos app xprop output
Comment 5 Kai Uwe Broulik 2017-02-20 12:26:35 UTC
Ah, you're using profiles, we only matched for -Default but not -Profile_n. Thanks.
Comment 6 Peter 2017-02-20 12:27:53 UTC
$ chromium --version
Chromium 56.0.2924.87

I've attached the requested files (.desktop file and xprop output).

I was doing some more testing, and created a shortcut for youtube which _does_ work as expected - but others don't.  Desktop files are identical apart from the name.  Interesting problem...
Comment 7 Peter 2017-02-20 12:29:03 UTC
Ahh, profiles!  That explains why my YouTube shortcut worked as expected -- I created it using the 'Default' profile.
Comment 8 Kai Uwe Broulik 2017-02-20 12:29:50 UTC
I'll have a look, thanks a lot for providing the needed data!
Comment 9 Peter 2017-02-20 12:31:33 UTC
Thanks for looking into it!
Comment 10 Kai Uwe Broulik 2017-02-20 12:41:45 UTC
Patch under review: https://phabricator.kde.org/D4680 (if you can, please give it a try)
Comment 11 Kai Uwe Broulik 2017-02-20 13:16:55 UTC
Git commit 513ad12b76a96d2919e1bbfae1c64ba9cfe72770 by Kai Uwe Broulik.
Committed on 20/02/2017 at 13:16.
Pushed by broulik into branch 'Plasma/5.9'.

Map StartupWMClass for Chrome apps instead of RegExp'ing the name

We only matched for the "Default" suffix which is the default profile but this breaks
when having apps installed in different profiles where they get e.g. "Profile_1" suffix.
FIXED-IN: 5.9.3

Differential Revision: https://phabricator.kde.org/D4680

M  +5    -10   libtaskmanager/taskmanagerrulesrc
M  +5    -1    libtaskmanager/xwindowtasksmodel.cpp

https://commits.kde.org/plasma-workspace/513ad12b76a96d2919e1bbfae1c64ba9cfe72770
Comment 12 Peter 2017-02-21 12:18:26 UTC
Thanks for getting onto this so quickly.  I'm very impressed by this experience.

It's been a very long time since I applied a patch and would take me some time to work through -- It may not be something I get to for another few days.

Just glancing over the differences makes sense to me, though it concerns me that the rewrite is tied to matching 'crx_'.  While this should fix actual Chrome apps, I also have a custom Desktop file I use to start up a local instance of Plex which simply runs Chromium with the --app flag and a local HTTP address.  I'll attach the desktop entry as an example.  I obtained the string for the StartupWMClass by running xprop on the window.

Launching this desktop entry in Gnome has the same behaviour as a Chrome app (ie. it does not group with other Chromium windows, rather it keeps it's own custom icon).  I presume that your patch would not cater for this scenario.
Comment 13 Peter 2017-02-21 12:19:20 UTC
Created attachment 104149 [details]
Custom Plex Desktop Entry
Comment 14 Peter 2017-02-21 12:50:01 UTC
Just as a final addendum:

I'm probably way off the mark here, but the logic that would make most sense to me is,

If the StartupWMClass != 'chromium' then do not group with chromium.
Comment 15 Eike Hein 2017-02-21 13:06:14 UTC
I'm working up an overhaul of StartupWMClass handling. The current behavior is written to match real world app behavior in the past, but tides have shifted and now we end up working around the code with mapping rules too often, so it probably makes sense to change the code and test it for a while in master to see what apps break (such is the sad reality of Task Manager development on X11 :).
Comment 16 Eike Hein 2017-02-21 14:27:39 UTC
Patch to overhaul StartupWMClass handling: https://phabricator.kde.org/D4706

This drops all the Chrome-related mapping rules in the process.
Comment 17 Eike Hein 2017-02-21 14:53:40 UTC
Above patch merged.
Comment 18 Peter 2017-02-21 19:38:12 UTC
Perfect!  Thanks!
Comment 19 Eike Hein 2017-02-22 08:57:04 UTC
Happy to help, thanks for the report!