Xpra: Ticket #1009: Shadow a specific region of an X server

I would like to be able to use xpra to access windows which have been already opened inside a X11 session. I know this is not possible, but Xpra can use the shadow feature to "copy" the whole X11 session. I would like to propose adding a feature to copy just a specific region of the X11 session (that presumably contains the window you want). Here's how I envision it to work:

  1. Start/use a bunch of windows inside a regular X11 session (e.g. at work). For now let's assume I am interested in shadowing Thunderbird and a terminal that has a specific string in the title bar (adrianp@procyon).
  1. Prepare to start xpra shadowing client on a different system (e.g. at home). However, I don't want to shadow the complete X11 session, because my work PC has two monitors with about 3000x1200 resolution that won't fit on a small laptop display. At this step we need to use wmctrl to extract the list of windows and their current geometry from the main X11 session:
  adrianp@frost:~$ wmctrl -l -G | egrep "Thunder|procyon"
  0x050000a0  0 0    48   1680 1026 frost To ME - Local Folders - Mozilla Thunderbird on frost
  0x04e0af60  0 993  589  657  410  frost adrianp@procyon (192.168.1.12) - byobu

The first hex string is a window id, next is a weight (which can be negative for panels or the desktop), next is the x coordinate of the left-most pixel, next is the y coordinate of the top-most pixel (of the window, it doesn't include the window manager's titlebar), next comes the x length followed by the y length and the window title.

Xpra should add a new "geometry" option to its shadow feature that should be compatible in format with wmctrl - something like:

 0,0,48,1680,1026 or just
 0,48,1680,1026 if you chose to ignore the weight.
  1. Start xpra with something like this:
     xpra shadow :0 --geometry 0,48,1680,1026
    

Ideally, if it's possible, it should allow the user to specify multiple geometry parameters to "extract" multiple independent screen regions. Otherwise the user could call xpra shadow multiple times.

Possible usage problems and solutions: Q: What if the window changes position/size serverside while shadowing? A: It's not xpra's job to track window changes

Q: What if the window is partially obscured by other windows? A: wmctrl can take care of that and bring the window in the foreground

 wmctrl -a <name>

Q: What if the window is still too large to fit comfortably the destination screen? A: wmctrl can resize (and reposition) a window:

 wmctrl -r <name> -e 0,0,48,1600,600

Q: Too bad I can't see the title bar/window controls A: You can instruct xpra to copy a bunch of pixels more on the y axis (in my example the Thunderbird window is maximized on my desktop and has x,y coordinates 0,48. The 48 means that the titlebar takes up 48 pixels, so you can instruct xpra to copy from 0,0 instead and add 48 to your y measurement so that the window isn't cut off).

Q: Wait! wmctrl complains it can't connect to the X server when run from ssh! A: You can always tell it which X server to interrogate:

 DISPLAY=:0 wmctrl -l -G
 DISPLAY=192.168.12.22:3 wmctrl -l -G


Thu, 22 Oct 2015 09:29:46 GMT - Antoine Martin: status, component, milestone changed

This should not be too hard, we just need to override:

Misc:


Sat, 27 Feb 2016 13:36:36 GMT - Antoine Martin: milestone changed

Out of time, maybe next release.


Tue, 12 Jul 2016 16:52:22 GMT - Antoine Martin: milestone changed

Milestone renamed


Wed, 07 Sep 2016 10:58:55 GMT - Antoine Martin: milestone changed


Sun, 28 Oct 2018 09:02:06 GMT - mad_ady:

I have another use case that could benefit from shadowing with custom offsets. Assume a x11 server running with a virtual display set with twice the X resolution than the screen (half the screen is visible). You could shadow only the remaining half to have it displayed on the other screen to gain a "virtual" dual screen display over network instead of locally (could help 2 systems with only one video output). A huge benefit would be performance-wise. For example, if the left side runs natively, while the right side shadows half the screen over network, you could play videos on the left without having to encode/transmit anything on the xpra connection, giving the impression of a dual-screen setup. Needs testing/tweaking, of course, even if shadowing offset would work.


Sat, 23 Jan 2021 05:12:22 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1009