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:
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.
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
This should not be too hard, we just need to override:
get_dimensions
in browser/xpra/trunk/src/xpra/server/shadow/root_window_model.py
get_image
, also tweak the size hints value
refresh
and _process_map_window
/ _process_configure_window
need to get the area to refresh (the offset) from the window model instead of just using the window size (relatively easy)
get_root_window_size
needs to be overriden... (maybe belongs in the model..)
Misc:
Out of time, maybe next release.
Milestone renamed
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.
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1009