| 1 | FAQ for xpra |
|---|
| 2 | ============ |
|---|
| 3 | |
|---|
| 4 | What is xpra? |
|---|
| 5 | ------------- |
|---|
| 6 | |
|---|
| 7 | Xpra is 'screen for X' -- it allows you to run X programs, usually on |
|---|
| 8 | a remote host, direct their display to your local machine, and then to |
|---|
| 9 | disconnect from these programs and reconnect from the same or another |
|---|
| 10 | machine, without losing any state. |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | Wait, isn't that what VNC does? |
|---|
| 14 | ------------------------------- |
|---|
| 15 | |
|---|
| 16 | VNC is another system for using apps remotely. The main difference |
|---|
| 17 | between xpra and VNC is that xpra is "rootless" -- i.e., programs you |
|---|
| 18 | run under it show up on your desktop as regular programs, managed by |
|---|
| 19 | your regular window manager, instead of being trapped inside a box. |
|---|
| 20 | It gives you "remote applications", not a "remote desktop". (Hence |
|---|
| 21 | the name -- "X Persistent Remote Applications".) |
|---|
| 22 | |
|---|
| 23 | Another difference is that VNC is far more portable -- you can get |
|---|
| 24 | both 'servers' and 'viewers' for essentially any operating system. |
|---|
| 25 | For xpra, you can only run X programs against the 'server', and the |
|---|
| 26 | current codebase also assumes some Unix-isms (e.g., unix domain |
|---|
| 27 | sockets). The xpra viewer is more portable (in principle) -- the |
|---|
| 28 | existing one should be able to work anywhere that GTK+ does, and it's |
|---|
| 29 | only a few hundred lines of code in any case, so is easy to replace. |
|---|
| 30 | |
|---|
| 31 | Basically, if you want a remote desktop, use VNC; if you just want to |
|---|
| 32 | run a few programs remotely, use xpra. |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | What about NX? |
|---|
| 36 | -------------- |
|---|
| 37 | |
|---|
| 38 | NX is the name for a protocol, rootless X server, mass of management |
|---|
| 39 | scripts, etc., produced by NoMachine Inc. There's some very nice tech |
|---|
| 40 | in NX, and in principle it can do everything that xpra does and more. |
|---|
| 41 | In practice, they offer either a super-slick, complete thin client |
|---|
| 42 | solution with some questionable (IMO) engineering decisions and a |
|---|
| 43 | proprietary license, or, a minimally-documented code dump of GPLed |
|---|
| 44 | software with a build system straight from the 1980s, an included fork |
|---|
| 45 | of the old X.org monolithic (!) tree, and if you somehow get it built |
|---|
| 46 | then it has all sorts of weird quirks to work around. Xpra, by |
|---|
| 47 | comparison, is <1000 source lines of code for the core, was written in |
|---|
| 48 | a weekend, and just works. |
|---|
| 49 | |
|---|
| 50 | NX seems aimed at large enterprise thin client deployments, and I just |
|---|
| 51 | want a way to run data visualization jobs that won't die when my |
|---|
| 52 | wireless does -- xpra is great for the latter. |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | And what about xmove? |
|---|
| 56 | --------------------- |
|---|
| 57 | |
|---|
| 58 | xmove is a tool designed to do exactly the same thing as xpra. The |
|---|
| 59 | main differences are that xmove uses a very different implementation |
|---|
| 60 | strategy (it implements a "pseudo" X server, while xpra takes |
|---|
| 61 | advantage of the standard X.org server), and that xmove has been |
|---|
| 62 | unmaintained since ~1997. |
|---|
| 63 | |
|---|
| 64 | I have not personally used xmove, and X clients tend to be very |
|---|
| 65 | conservative -- it's entirely possible that all modern X apps will |
|---|
| 66 | still work just fine against a 10+ year old server like xmove. |
|---|
| 67 | However, X *has* changed since then; for example, xmove does not |
|---|
| 68 | support the Render extension, which is essentially required if you |
|---|
| 69 | want anti-aliased fonts. Between the somewhat cumbersome design and |
|---|
| 70 | the lack of existing maintainers, this will almost certainly never get |
|---|
| 71 | fixed; nor will any other flaws that xmove may have. (For instance, |
|---|
| 72 | xpra looks easier to set up without writing custom shell scripts.) |
|---|
| 73 | |
|---|
| 74 | The other major issue with xmove's design is its sensitivity to |
|---|
| 75 | latency. Usually, if you're using a tool like xmove or xpra, it's |
|---|
| 76 | because you want to run an app on a remote computer. Usually you |
|---|
| 77 | don't have a local ethernet connection to that remote computer, but |
|---|
| 78 | rather something with a much higher ping time. Standard X forwarding |
|---|
| 79 | becomes notoriously slow and unusable in such situations -- and xmove |
|---|
| 80 | uses the same mechanisms as standard X. Xpra, on the other hand, uses |
|---|
| 81 | a protocol with no round trips, and applications forwarded by xpra |
|---|
| 82 | should remain snappy and responsive over connections that make X or |
|---|
| 83 | xmove crawl away to die. |
|---|
| 84 | |
|---|
| 85 | Still, like I said, I haven't actually used xmove, and would be |
|---|
| 86 | interested to hear from those who do. |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | Okay, so how do I try xpra? |
|---|
| 90 | --------------------------- |
|---|
| 91 | |
|---|
| 92 | Download the latest version from |
|---|
| 93 | http://partiwm.org/static/downloads/ |
|---|
| 94 | |
|---|
| 95 | Make sure you have the dependencies, at least: |
|---|
| 96 | development packages for python-gtk, and all dependencies |
|---|
| 97 | Xvfb |
|---|
| 98 | pyrex |
|---|
| 99 | On Debian-based OSes, I think it's: |
|---|
| 100 | # aptitude install libx11-dev libxtst-dev libxcomposite-dev \ |
|---|
| 101 | libxdamage-dev python-gobject-dev python-gtk2-dev xvfb python-pyrex |
|---|
| 102 | (If you work out a similar line for another OS, like Fedora or FreeBSD |
|---|
| 103 | or whatever, please send it in.) |
|---|
| 104 | |
|---|
| 105 | Build it: |
|---|
| 106 | tar xvzf parti-all-<whatever>.tar.gz |
|---|
| 107 | cd parti-all-<whatever> |
|---|
| 108 | ./do-build |
|---|
| 109 | export PYTHONPATH=$PWD/install/lib/python:$PYTHONPATH |
|---|
| 110 | (If running and displaying apps on two different machines, then you'll |
|---|
| 111 | need to do this on both of them, obviously.) |
|---|
| 112 | |
|---|
| 113 | On the machine where you will run the apps: |
|---|
| 114 | install/bin/xpra start :13 |
|---|
| 115 | |
|---|
| 116 | On the machine where you want the apps to display: |
|---|
| 117 | install/bin/xpra attach ssh:<remote box>:13 |
|---|
| 118 | or if displaying on the same machine for testing, just: |
|---|
| 119 | install/bin/xpra attach :13 |
|---|
| 120 | |
|---|
| 121 | Start some apps: |
|---|
| 122 | export DISPLAY=:13 |
|---|
| 123 | emacs |
|---|
| 124 | |
|---|
| 125 | |
|---|
| 126 | So how does it work? |
|---|
| 127 | -------------------- |
|---|
| 128 | |
|---|
| 129 | Very well, thank you. |
|---|
| 130 | |
|---|
| 131 | Oh, you mean... right. |
|---|
| 132 | |
|---|
| 133 | Okay. So you may have heard about these fancy newfangled "compositing |
|---|
| 134 | window managers". Here's how they work. Normally, when you run an |
|---|
| 135 | app under X, the app is responsible for drawing stuff into the windows |
|---|
| 136 | it owns, and then the X server combines those windows on the screen to |
|---|
| 137 | produce the final desktop view that you interact with. Compositing |
|---|
| 138 | managers change this. If you are running a compositing manager, then |
|---|
| 139 | each app still decides what goes in each of its own windows, but the X |
|---|
| 140 | server stops putting those windows on the screen. Instead, the job of |
|---|
| 141 | reading those images for each window and creating a display on the |
|---|
| 142 | screen falls to the compositing manager. |
|---|
| 143 | |
|---|
| 144 | Xpra works by connecting to an ordinary X server as a compositing |
|---|
| 145 | manager -- but instead of combining the window images to present on |
|---|
| 146 | the screen, it takes the window images and stuffs them into a network |
|---|
| 147 | connection to the xpra client, which then displays them onto the |
|---|
| 148 | *remote* screen. It also acts as a window manager for the X server it |
|---|
| 149 | is running against, but it doesn't actually have any window manager |
|---|
| 150 | policy built into it. Instead, it takes all the window management |
|---|
| 151 | requests from the applications, sends them over the wire to the |
|---|
| 152 | client, who then issues those same requests on the real display, waits |
|---|
| 153 | to see what answer your real window manager gives, and then forwards |
|---|
| 154 | that answer back to the xpra server. |
|---|
| 155 | |
|---|
| 156 | (So note that there are actually *two* X servers here -- one on your |
|---|
| 157 | remote host that your apps actually run against, and then the local |
|---|
| 158 | one that you're sitting at, where the apps end up being displayed.) |
|---|
| 159 | |
|---|
| 160 | Now, unless you're debugging xpra's guts, you never want to actually |
|---|
| 161 | see the X server that xpra is connected to, especially since it's |
|---|
| 162 | generally on some far away host that doesn't have a monitor, and if it |
|---|
| 163 | did the screen would just be black anyway (because we don't composite |
|---|
| 164 | properly, y'see). So 'xpra start' will silently spawn 'Xvfb', which |
|---|
| 165 | is a special X server with all its video drivers ripped out, and then |
|---|
| 166 | connect to it, so now that you've finished reading this section you |
|---|
| 167 | can forget all about it again and just use xpra and be happy. |
|---|
| 168 | |
|---|
| 169 | Maybe a picture with boxes in will help: |
|---|
| 170 | |
|---|
| 171 | +-----+ +--------+ |
|---|
| 172 | | | | your | +---------+ |
|---|
| 173 | | you | <-> | X | <-> |'xpra | |
|---|
| 174 | | | | server | | attach'| |
|---|
| 175 | +-----+ +--------+ +---------+ |
|---|
| 176 | ^ |
|---|
| 177 | | |
|---|
| 178 | INTERNET! |
|---|
| 179 | | |
|---|
| 180 | v |
|---|
| 181 | +---------+ |
|---|
| 182 | |'xpra | +------+ +-------------+ |
|---|
| 183 | | start'| <-> | | <-> | firefox | |
|---|
| 184 | +---------+ | Xvfb | | or whatever | |
|---|
| 185 | | | +-------------+ |
|---|
| 186 | +------+ |
|---|
| 187 | |
|---|
| 188 | |
|---|
| 189 | No, actually, I really did mean how *well* does it work? |
|---|
| 190 | -------------------------------------------------------- |
|---|
| 191 | |
|---|
| 192 | Oh. Sorry. Heh. |
|---|
| 193 | |
|---|
| 194 | As a first release, some lower priority features aren't included -- it |
|---|
| 195 | doesn't support window icons, transient hints, shaped windows, cursor |
|---|
| 196 | changing, input grabs, clipboard sharing, etc. These are all |
|---|
| 197 | straightforward to add, however, and in practice xpra seems to already |
|---|
| 198 | be very usable without them. |
|---|
| 199 | |
|---|
| 200 | I don't know yet how well it handles different bandwidth/latency |
|---|
| 201 | networks -- if you run xpra over a modem or something, let me know how |
|---|
| 202 | it goes for you. In principle, it should be dramatically less |
|---|
| 203 | latency-sensitive than raw X, and might use more or less bandwidth |
|---|
| 204 | depending on task, but in practice I haven't verified this. |
|---|
| 205 | |
|---|
| 206 | There are two main issues that are worth special warnings: |
|---|
| 207 | |
|---|
| 208 | First, I'm not sure yet how well the network protocol does at adapting |
|---|
| 209 | to the characteristics of your network -- i.e., scaling down how much |
|---|
| 210 | data it sends to avoid overloading the network and retain |
|---|
| 211 | responsiveness. In particular, if your TCP stack or your SSH client |
|---|
| 212 | do aggressive buffering, then this may screw up xpar's ability to |
|---|
| 213 | correctly adapt. If this happens, you might see applications "stall |
|---|
| 214 | out", i.e. stop responding. If you wait a few seconds, the buffers |
|---|
| 215 | should drain and things should return to normal. Let me know if you |
|---|
| 216 | see this happening frequently, though; if so we may need to add |
|---|
| 217 | countermeasures. |
|---|
| 218 | |
|---|
| 219 | Secondly, the X keyboard model makes it hard to get keypresses right. |
|---|
| 220 | If you have similar keymaps on both X servers, then you should be |
|---|
| 221 | fine. More complicated setups will probably not work -- e.g., if |
|---|
| 222 | xpra's Xvfb is running with an English keymap, and you try to type and |
|---|
| 223 | accented character that does not exist in that keymap, then it won't |
|---|
| 224 | work. This is a hard problem, in general, but improvements should be |
|---|
| 225 | possible. If you run into this, again, send an email -- extra points |
|---|
| 226 | if it contains a patch :-). |
|---|
| 227 | |
|---|
| 228 | |
|---|
| 229 | What's this 'parti' thing, and what does it have to do with xpra? |
|---|
| 230 | ----------------------------------------------------------------- |
|---|
| 231 | |
|---|
| 232 | Parti is a window manager that I'm working on. So I wrote a bunch of |
|---|
| 233 | WM code. Then I realized that with a few tweaks, I could have xpra, |
|---|
| 234 | and that would be awesome. So I ripped out parti's WM backend code |
|---|
| 235 | into a separate library, and now both parti and xpra use that library |
|---|
| 236 | ('wimpiggy'). Xpra is quite functional now, but Parti and wimpiggy |
|---|
| 237 | are still under heavy development, so for now I'm still keeping |
|---|
| 238 | everything together in one tree, to avoid version skew issues. |
|---|