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:
Preliminary patch: https://gerrit.libreoffice.org/#/c/74083/
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 { ...
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?
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.
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.
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.
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.
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.
Thread on wayland-devel: https://lists.freedesktop.org/archives/wayland-devel/2019-July/040704.html
Merged upstream commit in https://gitlab.freedesktop.org/wayland/wayland-protocols/commits/1.18 as https://gitlab.freedesktop.org/wayland/wayland-protocols/commit/e0d6ad1d5e7e80321285a9b14ca3329289eb02e6
Qt bug report: https://bugreports.qt.io/browse/QTBUG-77182
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
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.
Dear Jan-Marek Glogowski, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
I found a workaround for this (which is not a solution) by using window rules in Plasma. By right clicking on the title bar > more actions there is the possibility to configure special window settings. I have added the option Window Title, which should partly be equal to "Libreoffice Writer", then I enforce that with another option that the desktop filename "libreoffice-writer" is used. I repeat this for the other applications and now I have separate icons on my wayland taskbar for each libreoffice app.
*** Bug 148335 has been marked as a duplicate of this bug. ***
I can confirm that this bug is still present in LO 7.3.2
*** Bug 139921 has been marked as a duplicate of this bug. ***
Looking at this thread https://ask.fedoraproject.org/t/broken-icon-for-libreoffice-writer-in-wayland/4987 it looks like this bug is also there in Gnome so I wonder if this is definitely a Qt issue? It might be an overall LibreOffice issue on Wayland.
(In reply to Gauthier from comment #19) > Looking at this thread > https://ask.fedoraproject.org/t/broken-icon-for-libreoffice-writer-in- > wayland/4987 it looks like this bug is also there in Gnome so I wonder if > this is definitely a Qt issue? > > It might be an overall LibreOffice issue on Wayland. By now, it works when using the gtk3 VCL plugin, see commit 2d8e2813ddc87f7ce03b97e4d603df11613461f0 Author: Caolán McNamara Date: Wed Jul 8 10:13:26 2020 +0100 use gdk_wayland_window_set_application_id when it becomes available and https://gitlab.gnome.org/GNOME/gtk/-/issues/767 which is referenced in a comment added by the above commit. You can test this by starting LibreOffice with the environment variable SAL_USE_VCLPLUGIN=gtk3 set (and double-checking in "Help" -> "About LibreOffice" that gtk3 is actually used).
(In reply to Michael Weghorn from comment #20) > (In reply to Gauthier from comment #19) > > Looking at this thread > > https://ask.fedoraproject.org/t/broken-icon-for-libreoffice-writer-in- > > wayland/4987 it looks like this bug is also there in Gnome so I wonder if > > this is definitely a Qt issue? > > > > It might be an overall LibreOffice issue on Wayland. > > By now, it works when using the gtk3 VCL plugin, see > > commit 2d8e2813ddc87f7ce03b97e4d603df11613461f0 > Author: Caolán McNamara > Date: Wed Jul 8 10:13:26 2020 +0100 > > use gdk_wayland_window_set_application_id when it becomes available > > and https://gitlab.gnome.org/GNOME/gtk/-/issues/767 which is referenced in a > comment added by the above commit. > > You can test this by starting LibreOffice with the environment variable > SAL_USE_VCLPLUGIN=gtk3 set (and double-checking in "Help" -> "About > LibreOffice" that gtk3 is actually used). Unfortunately, this does not work on Ubuntu 20.04, using latest LO from PPA (7.3.3.2). However, when using SAL_USE_VCLPLUGIN=gen or SAL_USE_VCLPLUGIN=qt5, application icons are displayed correctly. Gtk3 is the only one working the other way around.
(In reply to defetov503 from comment #21) > Unfortunately, this does not work on Ubuntu 20.04, using latest LO from PPA > (7.3.3.2). What gtk version do you have? IIUC, this requires >= 3.24.22 (which contains the commit for https://gitlab.gnome.org/GNOME/gtk/-/issues/767 ). > However, when using SAL_USE_VCLPLUGIN=gen or > SAL_USE_VCLPLUGIN=qt5, application icons are displayed correctly. Gtk3 is > the only one working the other way around. SAL_USE_VCLPLUGIN=gen probably works because it is using X11 (xwayland). In the same way, it works for qt5/kf5 when forcing to use the Qt xcb platform plugin by setting environment variable QT_QPA_PLATFORM=xcb . For me, the generic icon is used for SAL_USE_VCLPLUGIN=qt5 (just as for kf5) if not setting QT_QPA_PLATFORM=xcb in addition.
(In reply to Michael Weghorn from comment #22) > What gtk version do you have? IIUC, this requires >= 3.24.22 (which contains > the commit for https://gitlab.gnome.org/GNOME/gtk/-/issues/767 ). Latest release of gtk3 for Ubuntu 20.04 was 3.24.20 (https://launchpad.net/ubuntu/+source/gtk+3.0/3.24.20-0ubuntu1.1) The only workaround for such systems would be a sandboxed version of LO. See snap, flatpak, etc.
Ok great, thanks for the info, so now we know the issue in only there with the qt5/kf5 backend. Do we know if there is anyone working on this at the qt / lo level?
(In reply to Gauthier from comment #24) > Ok great, thanks for the info, so now we know the issue in only there with > the qt5/kf5 backend. Do we know if there is anyone working on this at the qt > / lo level? (In reply to Jan-Marek Glogowski from comment #11) > Qt bug report: https://bugreports.qt.io/browse/QTBUG-77182 There isn't much to do on the LO level. If Qt is fixed, it's probably a single call to the new Qt API. I opened the QT bug report back in 2019 and nothing was done. Gtk is fixed, because Caolan prepared a patch himself. And I have enough other LO bugs to fix, so I doubt anything will change in the near future.
Seems like there is not much movement on the QT side of things, however the hack provided on comment 15 works well, thank you! Just a quick precision: for it to work it has to be done this way: Open say LibreOffice Calc, right click on title bar > More Actions and then go to: Configure Special Application Settings (and not Window Settings as described in comment 15) Then Add Property... > Window Title > there select Substring Match and leave only LibreOffice Calc Then Add Property...> Desktop file name > there select Force and enter libreoffice-calc At least that what works for me.
That is for those using KDE Plasma. Sorry for other QT based DE that do not have almighty Kwin rules ;)
Seems like there have been some update on this and apparently it is now doable since Qt 5.15. https://bugreports.qt.io/browse/QTBUG-77182
*** Bug 159250 has been marked as a duplicate of this bug. ***
(In reply to Gauthier from comment #28) > Seems like there have been some update on this and apparently it is now > doable since Qt 5.15. > > https://bugreports.qt.io/browse/QTBUG-77182 [1] in there describes how Qt API can be used to make newly created windows use a different icon than the first one, but IIUC that doesn't cover the LO use case of changing the icon of an *existing* window. Quoting also from the corresponding GTK issue ( https://gitlab.gnome.org/GNOME/gtk/-/issues/767 ): "LibreOffice recycles toplevel windows, e.g. writer to start center to calc." [1] https://bugreports.qt.io/browse/QTBUG-77182?focusedId=728535&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-728535
(In reply to Michael Weghorn from comment #30) > [1] in there describes how Qt API can be used to make newly created windows > use a different icon than the first one, but IIUC that doesn't cover the LO > use case of changing the icon of an *existing* window. > (...) > [1] > https://bugreports.qt.io/browse/QTBUG-77182?focusedId=728535&page=com. > atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-728535 David Redondo mentioned a way to make this work for existing windows as well (hide window, set new app id for the application, show again), which to me at least seems to be a reasonable workaround for now. Pending Gerrit change: https://gerrit.libreoffice.org/c/core/+/163249
Michael Weghorn committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/cea0371ac77145ad1f3db7e558c279aeed6f4d00 tdf#125934 qt: Support module-specific window icons on Wayland It will be available in 24.8.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.
Michael Weghorn committed a patch related to this issue. It has been pushed to "libreoffice-24-2": https://git.libreoffice.org/core/commit/eb9db0cd2f25a20e0efd756af3e34d4fb09b8e39 tdf#125934 qt: Support module-specific window icons on Wayland It will be available in 24.2.2. 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.
I have tested 24.2.2 RC! and nightly build on neon unstable and the bug persists. Operating System: KDE neon Unstable Edition KDE Plasma Version: 6.0.80 KDE Frameworks Version: 6.0.0 Qt Version: 6.6.2 Graphics Platform: Wayland
(In reply to Patrick Silva from comment #34) > I have tested 24.2.2 RC! and nightly build on neon unstable and the bug > persists. > > Operating System: KDE neon Unstable Edition > KDE Plasma Version: 6.0.80 > KDE Frameworks Version: 6.0.0 > Qt Version: 6.6.2 > Graphics Platform: Wayland Sorry, I meant 24.2.2 RC1 and daily build.
Created attachment 193171 [details] Screencast of it working in KDE Plasma unstable
(In reply to Patrick Silva from comment #34) > I have tested 24.2.2 RC! and nightly build on neon unstable and the bug > persists. > > Operating System: KDE neon Unstable Edition > KDE Plasma Version: 6.0.80 > KDE Frameworks Version: 6.0.0 > Qt Version: 6.6.2 > Graphics Platform: Wayland (In reply to Patrick Silva from comment #34) > I have tested 24.2.2 RC! and nightly build on neon unstable and the bug > persists. > > Operating System: KDE neon Unstable Edition > KDE Plasma Version: 6.0.80 > KDE Frameworks Version: 6.0.0 > Qt Version: 6.6.2 > Graphics Platform: Wayland Works fine for me with Neon unstable and 24.2.2 RC1 downloaded from the TDF website, s. screencast attachment 193171 [details]. Note that the mechanism relies on desktop files and icons being in the expected locations, e.g. a /usr/share/applications/libreoffice-writer.desktop that has a line `Icon=libreoffice-writer` and then an icon theme that supports an icon of that name. On KDE Neon, that file is provided by the Ubuntu package "libreoffice-writer". (The TDF packages only provide a /usr/share/applications/libreoffice24.2-writer.desktop, with a line `Icon=libreoffice24.2-writer`, so when not installing the distro-provided LO version, achieving the same would require some renaming of files. See also tdf#159656 Does that solve the issue for you? Otherwise: Did you download from the TDF website as well or get LO another way? Can you please paste the information from Help -> About LibreOffice and provide a screencast? Version: 24.2.2.1 (X86_64) / LibreOffice Community Build ID: bf759d854b5ab45b6ef0bfd22e51c6dc4fb8b882 CPU threads: 4; OS: Linux 6.5; UI render: default; VCL: kf5 (cairo+wayland) Locale: en-GB (en_GB.UTF-8); UI: en-US Calc: threaded
Created attachment 193179 [details] screen recording I downloaded my LO from the TDF website. Here is the information from Help -> About LibreOffice: Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 0b7494dfd361f7f2f7d8257b0a8a233a11f00679 CPU threads: 4; OS: Linux 6.8; UI render: default; VCL: kf5 (cairo+wayland) Locale: en-US (en_US.UTF-8); UI: en-US Calc: threaded Here are the names of the .desktop files: libreofficedev24.8-base.desktop libreofficedev24.8-calc.desktop libreofficedev24.8-draw.desktop libreofficedev24.8-impress.desktop libreofficedev24.8-math.desktop libreofficedev24.8-startcenter.desktop libreofficedev24.8-writer.desktop libreofficedev24.8-xsltfilter.desktop I have renamed them to the names below, and edited their "Icon=..." lines: libreoffice-base.desktop libreoffice-calc.desktop libreoffice-draw.desktop libreoffice-impress.desktop libreoffice-math.desktop libreoffice-startcenter.desktop libreoffice-writer.desktop libreoffice-xsltfilter.desktop Now all icons are correct. I'm attaching a screen recording showing the icons before renaming the .desktop files.
(In reply to Patrick Silva from comment #38) > (...) > I have renamed them to the names below, and edited their "Icon=..." lines: > libreoffice-base.desktop > libreoffice-calc.desktop > libreoffice-draw.desktop > libreoffice-impress.desktop > libreoffice-math.desktop > libreoffice-startcenter.desktop > libreoffice-writer.desktop > libreoffice-xsltfilter.desktop > > Now all icons are correct. Thanks for testing! (Renaming the files in the TDF packages/installation is probably not easily possible, as that would result in a clash with distro packages, i.e. they would no longer be co-installable.)