Bug 125921 - All LO apps use the WM_CLASS value of "soffice.bin", so different apps get grouped, and it's impossible to pin more than one to the Plasma Task Manager
Summary: All LO apps use the WM_CLASS value of "soffice.bin", so different apps get gr...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
6.2.4.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.4.0 target:6.3.0.1 target:6.2.6
Keywords:
Depends on:
Blocks: KDE, KF5
  Show dependency treegraph
 
Reported: 2019-06-14 12:48 UTC by Nate Graham
Modified: 2023-06-10 17:56 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2019-06-14 12:48:41 UTC
Description:
Because they share the same WM_CLASS values, the Plasma task manager sees them as the same app, leading to the following odd behaviors:
- When opening multiple apps, they are considered the same app and get grouped
- Only one app can be pinned to the Task Manager
- When you open any app, it first shows the wizard, which has a different icon, so the icon for your pinned Task Manager app changes while the wizard is open

Steps to Reproduce:
1. Use KDE Plasma (any recent version)
2. Use an Icons-only task manager
3. Install LibreOffice 6.2.4.2.0, using the kde5 VCL
4. Open Writer
5. Open Calc

Actual Results:
Both apps get grouped into the same Task Manager button because their WM_CLASS values are identical ("soffice.bin")

Expected Results:
Writer and Calc should be considered separate apps and not be grouped


Reproducible: Always


User Profile Reset: Yes



Additional Info:
See also https://bugs.documentfoundation.org/show_bug.cgi?id=119202
Comment 1 Jan-Marek Glogowski 2019-06-14 12:56:45 UTC
Everyone looking into this, please also read all the stuff in bug 119202. So a fix here doesn't reopen that. Eventually one will have to be closed as WONTFIX, or left open.
Comment 2 Nate Graham 2019-06-14 13:15:12 UTC
This comes with the additional hiccup that if you pin any LO apps from Kickoff (e.g. click on Kickoff/Application Launcher > Navigate to Apps > Office > right-click on Writer > Pin to Task Manager), then when you click on the pinned app to launch Writer, the pinned app does not transform itself into an instance of the app the way other apps do; rather, a new icon is created at the end of the Task Manager.
Comment 3 Jan-Marek Glogowski 2019-06-14 15:31:38 UTC
There is a KDE sprint from June 19th-26th 2019. We hope we can come to some conclusions how to address this problem the best for Plasma.

Pending patch, which basically copies gtk3 behavior by changing WM_CLASS on demand: https://gerrit.libreoffice.org/#/c/74014

That patch will stay at least blocked until after the Sprint.
Comment 4 Jan-Marek Glogowski 2019-06-14 15:45:53 UTC
(In reply to Nate Graham from comment #2)
> This comes with the additional hiccup that if you pin any LO apps from
> Kickoff (e.g. click on Kickoff/Application Launcher > Navigate to Apps >
> Office > right-click on Writer > Pin to Task Manager), then when you click
> on the pinned app to launch Writer, the pinned app does not transform itself
> into an instance of the app the way other apps do; rather, a new icon is
> created at the end of the Task Manager.

This is expected for the kde5 VCL plugin, as it doesn't set WM_CLASS (it's always the program name default, maybe from Qt); that is the fix for bug 119202.

LO is just one binary (soffice.bin), not individual programs for the modules. Without adapting the WM_CLASS there is no way to tell, what LO module is currently loaded inside a LO window. The individual desktop files for the LO modules have an entry like:

StartupWMClass=libreoffice-writer

which currently matches the class set by the gtk3 VCL plugin, dynamically changed based on the loaded document.
Comment 5 Jan-Marek Glogowski 2019-06-14 18:37:33 UTC
A few hours later, we already had a discussion on IRC with Nate Graham, Eike Hein and myself and we came to the conclusion that adapting the WM_CLASS approach is correct, even if it breaks official specs. Plasma 5.14+ can handle this correctly, and gtk3 uses it even longer. It's the way to go.

But since this is X11 specific, we'll need an additional fix for Wayland. For Wayland we have to change the appId, which is considered to be the equivalent to X11 WM_CLASS. Both are specified as static, but at least for WM_CLASS it is not enforced.

The proposal is to hack something up in QtWayland and then go to the Wayland people, if it fails, as it eventually might not work to change it, even if there is a "set_app_id" call and nothing I saw in there talks about fixed (https://github.com/wayland-project/wayland-protocols/blob/master/stable/xdg-shell/xdg-shell.xml#L590).
Comment 6 Commit Notification 2019-06-15 00:38:40 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/77a3c443d35c7d966217f02ea9189cb1819c7828%5E%21

tdf#125921 Qt5 set WM_CLASS for top level windows

It will be available in 6.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Nate Graham 2019-06-15 01:33:16 UTC
\o/

Thanks so much for the super quick resolution on this!!!
Comment 8 Commit Notification 2019-06-15 08:31:56 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

https://git.libreoffice.org/core/+/1a1e13333e8145c7a78ddb23b540b0832cadd446%5E%21

tdf#125921 Qt5 set WM_CLASS for top level windows

It will be available in 6.3.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2019-06-18 05:37:36 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

https://git.libreoffice.org/core/+/d7b88e962f8907b00eef648e7d69f2cd20f51ac8%5E%21

tdf#125921 Qt5 set WM_CLASS for top level windows

It will be available in 6.2.6.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Alexander M. 2019-07-25 18:14:18 UTC
Hello,

I know this bug is marked as FIXED, and it is indeed mostly fixed, but I wanted to ask here before opening a new bug:

I tested 6.3 (the AppImage version) and I noticed that, while top-level windows do indeed change their WM_CLASS correctly now and therefore stay grouped, the Open/Save file dialog still shows up as "soffice.bin" and as a result creates a second entry in the taskbar when it is invoked, as if it were a separate application, instead of being grouped with the LO app that invoked it.

If this is not some quirk of the AppImage format but the standard behavior of LO 6.3, then shouldn't it be addressed as well?