I have multiple displays open on a central server. Is it possible to "move" a X-window application that is running on a particular DISPLAY to a different DISPLAY? How can this be done?

I'm using xpra with multiple remote displays.


It isn’t possible to move a running X window application to a different display, as determined by the DISPLAY variable, for two reasons.

The first is that it’s difficult to change a running process’ environment, and impossible to do it reliably and in such a way that the change is taken into account.

The second is that the DISPLAY variable is only an input, and typically it’s only considered at application startup. An X application calls XOpenDisplay early in its startup, directly or indirectly, and that (or rather, XTOpenDisplay) is what takes DISPLAY into account (if necessary — the X server to use can be specified in other ways). XOpenDisplay returns a pointer to an opaque Display structure which represents the connection to the X server, and that’s all that’s used to talk to the X server thereafter. Changing the value of DISPLAY after this won’t have any effect; the application would somehow have to realise that the value has changed, close its connection to the X server, and open a new one.

Both points taken together means that it’s very difficult even to write an application which can change its display (because it’s designed to do so), let alone change the display when an application doesn’t expect it to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.