Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wishlist: shadowing only the display space corresponding to an external monitor #3320

Closed
callegar opened this issue Oct 20, 2021 · 7 comments
Labels

Comments

@callegar
Copy link

I would like to shadow only one part of a display, namely the one corresponding to an external monitor.

It is my understanding that the shadow operation mode shadows a full display. Namely if you have an external monitor attached, that is placed, e.g. right of your standard screen via xrandr, xpra will shadow the full display area (namely the one extending from your standard screen to the right to include also the area corresponding to your external monitor).

Would it be possible to introduce switches to shadow only the area corresponding to the external monitor — or if switches to achieve this goal already exist to better document them, maybe with an example?

This would be extra-useful. Specifically, it would let you attach a "virtual display adapter" to the external (HDMI/DP) port of a computer (see https://www.amazon.com/s?k=virtual+display+adapter) to pretend that there is an external monitor attached and make your desktop environment and applications use it. Then it would let you virtualize this monitor over xpra to some other place (e.g. inside a web-browser in a tablet). In other words it would let you do the same thing that can be done with deskreen (https://deskreen.com/), but most likely with the better efficiency and flexibility of xpra in terms of encodings, etc.

@totaam
Copy link
Collaborator

totaam commented Oct 20, 2021

Adding the code to support arbitrary shadow geometries should be quite easy.
What's more difficult is to provide a user-friendly way of specifying these geometries.
I think we can probably start with a syntax like this one:

xpra shadow :0,HDMI-2

And locate the matching display.
or:

xpra shadow: :0,1920x1080@1920,0

And just use the geometry specified.

What's likely to be more difficult is handling of monitor hot-plugging, but we can worry about that later.

@callegar
Copy link
Author

This would be great!

Even if it is not 100% related, I would like to annotate that I have asked the xrandr developers if it would be possible on their side to provide a way to pretend completely in software that an external monitor is attached. This would save the use of a virtual adapter plug in many occasions. See (https://gitlab.freedesktop.org/xorg/app/xrandr/-/issues/59#note_1108355). They have indicated that there should be no need for that because if an output has a mode set, it should be considered enabled, but unfortunately many clients do not seem to behave in this way (most notably KDE Plasma and libreoffice).

I am reporting this because:

  • To conform to what the xrandr developers say, xpra should let one do xpra shadow :0,HDMI-2 as soon as the output has a mode set, even if it is not reported as connected.
  • If there is a way for xpra to interact with the display machinery at a level that is not possible with the xrandr cli, I wonder if the lower level interface could let xpra cause the monitor to appear as connected to the clients when it starts shadowing it.

@totaam
Copy link
Collaborator

totaam commented Oct 21, 2021

Initial support added in the commit above.
With this small change, I can run:

xpra shadow :1,DP-2 --no-daemon -d screen

To shadow just the DP-2 output.

The syntax is likely to change to support more generic filters and options. Perhaps :1,plug=DP-2 and :1,geometry=1920x1080@0x0, etc..

totaam added a commit that referenced this issue Oct 30, 2021
try to parse the string as a list of geometries and use plug_name as fallback
@totaam
Copy link
Collaborator

totaam commented Oct 30, 2021

With the commits above, we now support this feature with MS Windows shadow servers and using a more user friendly syntax:

  • just as before, this will shadow all monitors of the display specified:
    xpra shadow :1
  • we can now disable window-per-monitor mode more easily with:
    xpra shadow :1,multi-window=no
  • we can shadow a specific output:
    xpra shadow :1,DP-1
    Or more explicitly with:
    xpra shadow :1,plug=DP-1
  • to limit the size:
    xpra shadow :1,1920x1080
  • size and location:
    xpra shadow :1,1920x1080@1280x0
    or more explicitly:
    xpra shadow :1,geometry=1920x1080@1280x0
  • this can also be used to specify multiple areas:
    xpra shadow :1,1920x1080@1280x0/1280x600@0x400

On MS Windows and MacOS, the display name (:1 in the examples above) is not used but it is still required. Use: xpra shadow Main,options..


To get the list of output names (ie: DP-1 in the examples above), look at the client's command line output (Xpra_cmd.exe on MS Windows) or run with an invalid value: xpra shadow Main,help.

This feature is available in beta builds 4.3-r30301 and later.

@totaam totaam closed this as completed Oct 30, 2021
@totaam
Copy link
Collaborator

totaam commented Nov 1, 2021

This information has been added to the man page: a0e0b5e

@normanr
Copy link

normanr commented Dec 16, 2021

There seems to be a way to add a virtual output with evdi (https://unix.stackexchange.com/a/585078). I have not yet tested it.

@totaam
Copy link
Collaborator

totaam commented Dec 17, 2021

@normanr please see #3390 and comment there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants