Created attachment 146792 [details] error SUMMARY When launching some gtk3 apps on wayland error pops out. When launching with overview X11 or when launching with krunner on wayland there is no error. STEPS TO REPRODUCE 1. Login with Wayland session 2. Launch app using overview effect (gnome calendar, gnome disks, tilix, pamac, cockpit client (flatpak)) OBSERVED RESULT App launches with notification containing error: org.freedesktop.DBus.Error.UnknownMethod EXPECTED RESULT App launches without error. SOFTWARE/OS VERSIONS Linux/KDE Plasma: Arch KDE Plasma Version: 5.24.1 KDE Frameworks Version: 5.91 Qt Version: 5.15.2 ADDITIONAL INFORMATION Might be regression with https://bugs.kde.org/show_bug.cgi?id=450000
This is most likely related to the DBus-activation support in KIO::ApplicationLauncherJob However kstart5 --application org.gnome.Calendar works fine, so it seems somewhat kwin-specific
QDBusError("org.freedesktop.DBus.Error.UnknownMethod", "Method \"Activate\" with signature \"a{sv}\" on interface \"org.freedesktop.Application\" doesn't exist\n") Happens only when called from kwin_wayland indeed
It looks like "Activate" is called twice: QDBusMessage(type=MethodCall, service="", path="/", interface="org.freedesktop.Application", member="Activate", signature="", contents=() ) QDBusMessage(type=MethodCall, service="org.gnome.Calendar", path="/org/gnome/Calendar", interface="org.freedesktop.Application", member="Activate", signature="", contents=() ) when using kstart5 it's only once: QDBusMessage(type=MethodCall, service="org.gnome.Calendar", path="/org/gnome/Calendar", interface="org.freedesktop.Application", member="Activate", signature="", contents=() )
Oh this is a fun one. Here's what happens: - Kwin/overview use KIO::ApplicationLauncherJob to launch the app - ApplicationLauncherJob finds that the target supports DBus activation - ApplicationLauncherJob notices we are on Wayland and requests an XDG activation token: https://invent.kde.org/frameworks/kio/-/blob/master/src/gui/kprocessrunner.cpp#L313. It connects the token arriving to launching the app - Further down it sets which app should be launched: https://invent.kde.org/frameworks/kio/-/blob/master/src/gui/kprocessrunner.cpp#L320 - Further down it starts the app when we are not waiting for a token: https://invent.kde.org/frameworks/kio/-/blob/master/src/gui/kprocessrunner.cpp#L343 So far so good. So why does it fail only in kwin_wayland? Usually the token arrives asynchronously, so the app is already set and it launches fine. However, in KWindowSystem::requestXdgActivationToken there is a check for KWindowSystemPrivateV2, and if that fails it directly emits xdgActivationTokenArrived: https://invent.kde.org/frameworks/kwindowsystem/-/blob/master/src/kwindowsystem.cpp#L819 This makes the token arrival no longer async and all the slots are triggered directly (since it's not a queued connection), which leads to the app being launched before m_service is set. boom
And why does the check fail? because kwin has its own kwindowsystem plugin that doesn't implement V2 of the interface
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kwindowsystem/-/merge_requests/49
Another obvious fix would be to implement V2 of the interface in kwin, but not sure whether having a correct activation token is even important here
I think it is relevant for activating running instances of single-window apps from the overview?
Git commit 8d580e2fa466fdb47a82a19f42ba78424f424c41 by Nicolas Fella. Committed on 15/02/2022 at 22:30. Pushed by nicolasfella into branch 'master'. Ensure that xdgActivationTokenArrived is always emitted asynchronously Otherwise consumers that expect it to be async break M +6 -1 src/kwindowsystem.cpp https://invent.kde.org/frameworks/kwindowsystem/commit/8d580e2fa466fdb47a82a19f42ba78424f424c41