Cool utility of the week: xpra

At work we’re going to be transitioning to a new VPN solution pretty soon, one which has a rather obnoxious limitation around reuse of IP addresses. This has a specifically BAD effect on ssh sessions, in that we can’t keep them going when we reconnect.

I’ve been casting around for something that would let me get past this; the conventional solution is to run ‘screen’, which is all well and good except it has no gui capability as far as I can determine.

Enter, therefore, xpra – described by its inventor as screen for X. Just what I was looking for, really.

To build it you need Cython, I didn’t install Cython but just set PYTHONPATH to include it before running xpra’s

$ PYTHONPATH=/path/to/cython/dir:$PYTHONPATH python install --prefix /path/where/I/want/xpra/installed

To run it you need to have Xvfb installed, too.

Once I’d figured out that I needed to add

import os
sys.path.insert(os.path.realpath(os.path.join(os.path.dirname(__file__), "../lib/python")))

AND add a symlink in lib from python to python2.6 (doofus!), I was able to run xpra from wherever, without setting PYTHONPATH first. [For reference, I've added this info to].

So .. all hail xpra! I startup a session on $usefulhost inside the VPN connection, export my DISPLAY and then whatever gui tools I need will use that X display. On my system at home, I attach to the host:display and then every utility I’ve got running with that display pops up on my local screen.

usefulhost $ ~/bin/xpra start :200
usefulhost $ DISPLAY=:200 ; export DISPLAY
usefulhost $ filemerge &
usefulhost $ /usr/bin/packagemanager &
mylocalhost $ ~/bin/xpra attach ssh:remotehost:200

Falling off a log isn’t as easy as this.