Single-instance window activation doesn't work on Plasma Wayland
Tested with Nautilus and gnome-calendar 43.1 on Fedora 37 KDE.
- Open an app with single-instance behavior
- Focus another window
- Open the same app again from Plasma's application laucher
- The existing window should now be raised, but isn't. Instead the taskbar entry turns orange, indicating that the app wants to be raised but it was denied by the compositor
Running the first nautilus instance with WAYLAND_DEBUG=1 shows
[2582383.310] -> xdg_activation_v1@16.get_activation_token(new id xdg_activation_token_v1@40)
[2582383.368] -> xdg_activation_token_v1@40.set_serial(88661, wl_seat@20)
[2582383.396] -> xdg_activation_token_v1@40.set_surface(wl_surface@30)
[2582383.418] -> xdg_activation_token_v1@40.commit()
[2582388.603] xdg_activation_token_v1@40.done("not-granted-666")
[2582388.641] -> xdg_activation_token_v1@40.destroy()
[2582388.662] -> xdg_activation_v1@16.activate("not-granted-666", wl_surface@30)
This shows that the app is requesting an activation token from the compositor for its own surface. This is rejected by the compositor because the surface is not the active one. Then the invalid token is used to try and activate the window, which is consequently rejected.
Instead of requesting a token itself the app must use the token provided by Plasma when launching, either through the XDG_ACTIVATION_TOKEN environment variable or the platform_data argument when using DBus activation (Plasma supports both). This is described in the xdg-activation protocol specification.