Skip to content

Add the ability to stream a rectangular region

Background

On a large panel, current screen casting options could be found lackluster, for different reasons. Streaming the entire screen is usually undesirable, because:

  • it will look too small on other people's screens (some apps allow zooming, but many don't)
  • bandwidth is being unnecessarily consumed
  • large images often incur greater amounts of compression artifacts
  • usually (but not always), there will be irrelevant sections of the screen which will nonetheless be streamed

As a workaround, it is possible to stream a single window. However, this comes with its own problems:

  • context menus (incl. global menu) are not visible to the viewers
  • popup windows (e.g. Krita's layer filters) are not visible to the viewers
  • switching between windows (e.g. code editor and live preview) requires ending and restarting the stream

Finally, there are virtual outputs, but since they only exist in virtual space, this means the only way to observe their contents is through the app that is streaming them. Often times, this comes with significant latency and/or reduction in FPS, making it difficult for the streamer to interact with the streamed content.

Solution

This MR adds the ability to stream a rectangular subregion of the user's screen. Upon selecting the output "Rectangular Region" in portal, the user will be prompted to click & drag a rectangular region, which will then subsequently be streamed. The user has the option to reset the region by right-clicking during the drag process, as well as cancelling altogether by pressing Escape, upon which the portal dialog will be reopened.

This makes it possible to do the following, without streaming the entire screen:

  • stream multiple windows at once
  • stream context menus (incl. global menu)
  • switch between windows without having to restart the stream

Preview

rec1

ToDo's

  • Wait for kwin!3561 (merged) to be merged (there's currently a KWin bug that incorrectly offsets the y-coordinate of the streamed region)
  • Test with a multi-monitor setup
  • Force the regular fade in/-out animation for the overlay not possible (yet)

Known Issues

  • When changing the workspace proportions (through adding/removing a new monitor or virtual output) towards negative X or Y (= left or upwards), the streamed region is not correctly preserved, but is instead shifted towards the added space / away from the removed space.

Relevant Tickets

BUG: 464147

Edited by Dominique Hummel

Merge request reports