Bug 464147 - Support selecting which region to share
Summary: Support selecting which region to share
Alias: None
Product: xdg-desktop-portal-kde
Classification: Plasma
Component: general (show other bugs)
Version: 5.25.5
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: Plasma Bugs List
Depends on:
Reported: 2023-01-11 12:29 UTC by pinon.pierre
Modified: 2023-02-13 23:18 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.0
Sentry Crash Report:


Note You need to log in before you can comment on or make changes to this bug.
Description pinon.pierre 2023-01-11 12:29:02 UTC
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports

1. Go on Google Chrome > Communication Tool with screen share (Google Meet or Slack or any other app with screen share) > Share Screen
2. Choose Virtual Output


It automatically created a virtual screen, a screen "zone" instead of share all the screen.
And it's exactly what I want on my 32/9 screen!

But the virtual output resolution is 1920x1080


Is it possible to change the virtual output resolution?

Linux/KDE Plasma: Ubuntu 22.10
(available in About System)
KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6


WirePlumber: 0.4.12-1
PipeWire: 0.3.58

Thanks a lot for your help
Comment 1 Bug Janitor Service 2023-01-11 12:33:30 UTC
Thank you for the bug report!

Please note that Plasma 5.25.5 is not supported for much longer by KDE; supported versions are 5.24, and 5.26 or newer.

If at all possible please upgrade to a supported version and verify that the bug is still happening there.

If you're unsure how to do this, contact your distributor about it.
Comment 2 pinon.pierre 2023-01-11 12:43:00 UTC
My issue is exactly valid for the 5.26 too
Comment 3 Aleix Pol 2023-01-11 15:02:15 UTC
The virtual output option is to share the output that isn't one of your physical ones.

If you want to share the outputs of your physical displays, you will need to choose them instead. It has nothing to do with the resolution.
Comment 4 pinon.pierre 2023-01-11 15:04:30 UTC

Thanks for your answer.

I don't want to share a physical output, I just want to configure the resolution of the virtual output (By default it's 1920x1080)

Thanks a lot
Comment 5 Aleix Pol 2023-01-11 15:22:10 UTC
Can you ellaborate a bit on why 1920x1080 doesn't fit then? Do you want it to match your 32/9?
Comment 6 pinon.pierre 2023-01-11 15:27:44 UTC
Yes, sure.

My physical screen resolution is 5120x1440 (32/9)

I just want to share the left side of my physical screen 2560x1440 (WQHD => 16/9) because it's more confortable for user that work with me
Comment 7 pinon.pierre 2023-01-11 15:28:36 UTC
(In reply to pinon.pierre from comment #6)
> Yes, sure.
> My physical screen resolution is 5120x1440 (32/9)
> I just want to share the left side of my physical screen 2560x1440 (WQHD =>
> 16/9) because it's more confortable for user that work with me

And it's of course complex for me to resize my window to feat the virtual screen in 1920x1080
Comment 8 Aleix Pol 2023-01-13 17:41:34 UTC
Would having a selectable region option make it easier then? It seems like it's what you want to do anyway.
Comment 9 pinon.pierre 2023-01-14 08:28:18 UTC
(In reply to Aleix Pol from comment #8)
> Would having a selectable region option make it easier then? It seems like
> it's what you want to do anyway.

That would be perfect!

Comment 10 Aleix Pol 2023-02-13 02:03:38 UTC
Git commit 6a83f327e9111703fe63a69bb6a2ff987278bbfc by Aleix Pol Gonzalez, on behalf of Dominique Hummel.
Committed on 13/02/2023 at 02:03.
Pushed by apol into branch 'master'.

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


## ToDo's

- [x] Wait for https://invent.kde.org/plasma/kwin/-/merge_requests/3561 to be merged (there's currently a KWin bug that incorrectly offsets the y-coordinate of the streamed region)
- [x] Test with a multi-monitor setup
- [x] ~~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

M  +3    -0    CMakeLists.txt
M  +2    -0    src/CMakeLists.txt
M  +6    -0    src/outputsmodel.cpp
M  +1    -0    src/outputsmodel.h
M  +1    -1    src/quickdialog.h
A  +9    -0    src/region-select/FloatingBackground.qml  *
A  +27   -0    src/region-select/FloatingTextBox.qml  *
A  +216  -0    src/region-select/RegionSelectOverlay.qml  *
A  +248  -0    src/region-select/SelectionEditor.cpp  *
A  +52   -0    src/region-select/SelectionEditor.h  *
M  +3    -0    src/resources.qrc
M  +5    -0    src/screencast.cpp
M  +39   -1    src/screenchooserdialog.cpp
M  +10   -0    src/screenchooserdialog.h
M  +15   -0    src/waylandintegration.cpp
M  +2    -0    src/waylandintegration.h
M  +1    -0    src/waylandintegration_p.h

The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.