Skip to content

Use KWin ScreenShot2 DBus API whenever available

Noah Davis requested to merge work/ndavis/platformkwin into master

This means we will now use it on X11. This patch has a number of positives, short term issues and longer term issues.

Pros:

  • More consistent behavior between X11 and Wayland. A feature added to the DBus API for Wayland or X11 may (but not necessarily) mean we don't need to reimplement it for the other. A bug fixed for one may (but not necessarily) mean we don't need to fix it for the other.
  • Less complicated to maintain than PlatformXcb since a majority of the complexity is actually in KWin.
  • Interactive window picking and screen picking is nice.
  • Works with Plasma/KWin 6. PlatformXcb is currently a bit broken with KWin 6 since it was never ported from ScreenShot to ScreenShot2.

Shorter term issues:

I want to fix these in a separate MR since I already have too many patches piled up.

  • Selection region has some issues with the coordinates being offset. Should be fixable in SelectionEditor.
  • When the rectangle screenshot is accepted, the left screen may be overlapped by the right screen. Should be fixable in SelectionEditor.

Longer term issues:

These are things that will take longer to fix or that might not be fixed.

  • Relies on the Plasma release cycle while Spectacle is on the Gear cycle.
  • No support for capturing transient parent windows (e.g., the parent of a popup menu). Maybe an extra option for the KWin ScreenShot2 DBus API would solve that.
  • You cannot capture popup menus interactively. This may be fixable on Wayland, but potentially not on X11 due to how X11 handles popup windows. https://bugs.kde.org/show_bug.cgi?id=470341
  • PlatformXcb will bitrot since most of us won't be using it regularly anymore. Spectacle may eventually become practically Plasma/KWin only, even on X11. This will be bad for non-Plasma users (obviously) and bad for Plasma users that try to use other WMs like i3wm. A possible alternative to maintaining the complex PlatformXcb backend would be dropping it in favor of a backend for XDG screenshot portal support. The screenshot portal currently can't give as good of a UX or the same features as the KWin DBus API, but it should at least allow spectacle to work without KWin and be reasonably future proof. If it ever becomes good enough, we might even be able to drop the KWin specific backend.

Merge request reports