workspace: implement X11<->Wayland activation interoperability

It works like this for X11 -> Wayland:

  • X11 app posts a "new" message with the app id of the window to be activated
  • Wayland client uses the message contents as an activation token

and is implemented by simply setting the activation token to the startup message ID (+ up to date serial) if the active window belongs to the same process that posted the "new" message.

For Wayland->X11 it works like this:

  • Wayland client creates an activation token
  • X11 app posts the "remove" message with the token as the content

and it's implemented by recording the pid of the X11 app and checking it + the serial of the activation token when activating the window.

In theory, this should work completely fine. However, in practice, there are some problems:

  • set QT_QPA_PLATFORM=xcb in Dolphin's .desktop file, now start it from plasmashell. Plasmashell sets XDG_ACTIVATION_TOKEN for Dolphin, so when I open a video (in mpv), that uses the activation token and doesn't get activated because the token is old
    • this seems like a pretty big problem with the interop idea. Is there anything we can do about it?
  • we don't seem to set DESKTOP_STARTUP_ID in any of our apps if they're Wayland native, not even in plasmashell!
  • apparently we may get the "remove" message after the app created a window and requested activation
    • maybe we just need to retry activation for windows of the relevant client? Pretty ugly, but I don't really see a better way?
  • Discord neither sets nor uses DESKTOP_STARTUP_ID. I'm not all that surprised about lacking app support though

I don't think any of these problems are significant enough that we can't merge this, but clearly there's plenty more to do...

Merge request reports

Loading
Loading