Bug Hunting Session
Bug 125934 - No application icon on Wayland with the qt5 / kf5 backend
Summary: No application icon on Wayland with the qt5 / kf5 backend
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
6.2.0.3 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.4.0 target:6.3.0.1
Keywords:
Depends on:
Blocks: KDE Qt5
  Show dependency treegraph
 
Reported: 2019-06-15 09:28 UTC by Jan-Marek Glogowski
Modified: 2019-10-29 09:42 UTC (History)
4 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 Jan-Marek Glogowski 2019-06-15 09:28:36 UTC
Description:
In Wayland the application icon is loaded from the desktop file by the compositor. Therefore Qt has an API call to set the desktop file for the application, which correctly sets the appId on Wayland: QGuiApplication::setDesktopFileName

But this still leaves us with just a single icon. There is a Wayland API to set a surfaces appId via the XDG shell protocol: set_app_id. This is - AFAIK - the same call that is used by setDesktopFileName, but it can be used per Wayland surface and isn't restricted to the global QGuiApplication. A XDG surface normally maps to a top level window or a popup. And Michael tested that changing the setDesktopFileName also changes the icon for the next created window.

I'm told that appId is supposed to be fixed like the WM_CLASS, but just like the latter, it's currently not enforced. So changing appId works and the icon of the window changes, but currently has side effects, like crashes in "kwin_wayland --xwayland" on shutdown. It works fine with Weston 5.0.0-3 on Debian Buster.


Steps to Reproduce:
1. Start LO on Wayland with the kde5 backend


Actual Results:
The task manager and the window decorations show the default Wayland icon.

Expected Results:
The task manager and the window decorations show the document / module specific LO icon.


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 Jan-Marek Glogowski 2019-06-15 09:35:56 UTC
Preliminary patch: https://gerrit.libreoffice.org/#/c/74083/
Comment 2 Jan-Marek Glogowski 2019-06-15 09:44:17 UTC
From the QtWayland source:

dist/changes-5.7.0:- Set appId according to QGuiApplication::desktopFileName()

https://code.qt.io/cgit/qt/qtwayland.git/tree/src/client/qwaylandwindow.cpp#n151

// The appId is the desktop entry identifier that should follow the
// reverse DNS convention (see http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s02.html).
// According to xdg-shell the appId is only the name, without
// the .desktop suffix.
//
// If the application specifies the desktop file name use that
// removing the ".desktop" suffix, otherwise fall back to the 
// executable name and prepend the reversed organization domain
// when available.
if (!QGuiApplication::desktopFileName().isEmpty()) {
    QString name = QGuiApplication::desktopFileName();
    if (name.endsWith(QLatin1String(".desktop")))
        name.chop(8);
    mShellSurface->setAppId(name);
} else {
...
Comment 3 Jan-Marek Glogowski 2019-06-15 10:43:51 UTC
So thinking about this a bit more, maybe there should be an overload for QWindow::setIcon, which accepts the desktop file as a QString. IMHO it shouldn't accept a file name on other platforms as a convenience to load an icon. Or just allow a desktop file per QWindow? QIcon::fromTheme shouldn't work, as the icon is specified in the desktop file, not the theme. Maybe a QIcon::fromDesktopFile?
Comment 4 Commit Notification 2019-06-15 12:55:32 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "master":

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

tdf#125934 Qt5 set the desktop file name

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 5 Commit Notification 2019-06-15 14:17:47 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

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

tdf#125934 Qt5 set the desktop file name

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 6 Caolán McNamara 2019-06-15 20:32:30 UTC
our one-window which changes to be different applications, e.g. from writer to startcenter, to calc, is unusual.

When this arose for the gtk3 case I eventually gave up on per-libreoffice-component icons for libreoffice under wayland and used the universal generic start-center one i.e. https://cgit.freedesktop.org/libreoffice/core/commit/?id=6903066822900a700ccf67ae70fa171c94644a9a which has some bug ids tracking my efforts across some bug trackers. I had hoped that something would come along to solve this somewhere along the line, but AFAIK nothing did

There was some other gtk api to set the icon image, I forget which one, but it (at the time at least) also didn't work under gtk.

 I also tried unmappaping the window and replacing it with another of a different appid, but that looked even weirder.
Comment 7 Commit Notification 2019-06-18 18:23:22 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "master":

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

tdf#125934 Qt5 set the desktop file name...

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 8 Commit Notification 2019-06-18 21:30:12 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "libreoffice-6-3":

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

tdf#125934 Qt5 set the desktop file name...

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 Jan-Marek Glogowski 2019-07-07 13:54:43 UTC
Thread on wayland-devel: https://lists.freedesktop.org/archives/wayland-devel/2019-July/040704.html
Comment 11 Jan-Marek Glogowski 2019-07-25 11:12:38 UTC
Qt bug report: https://bugreports.qt.io/browse/QTBUG-77182
Comment 12 Xisco Faulí 2019-10-29 09:31:55 UTC
A polite ping to Jan-Marek Glogowski:
Is this bug fixed? if so, could you please close it as RESOLVED FIXED ? Otherwise, Could you please explain what's missing?
Thanks
Comment 13 Jan-Marek Glogowski 2019-10-29 09:42:58 UTC
This is not fixed, as it needs upstream Qt changes and then fixes to LO. Since I currently have no time to fix this, I'm unassigning this bug. I would also reset this to UNCONFIRMED, but that is not available in my dropdown box, so it goes to NEW. And I also set the version to 6.2, as there wasn't any kde5 / qt5 backend before this release.