Clipboard

This feature allows you to copy from outside the xpra session and paste inside it, and vice versa. For various reasons, this doesn't always work quite as well as expected - see below for more details.

Platform specific issues:

* Mac OSX and MS Windows clients only have a single clipboard selection whereas X11 has three: `CLIPBOARD`, `PRIMARY` and `SECONDARY`; therefore we need to choose which one to exchange with: see `local-clipboard` and `remote-clipboard` switches * Mac OSX and MS Windows clients synchronize the remote `PRIMARY` selection by default: see [selections](#selections) below * on MS Windows, the OS requests the clipboard data as soon as we claim ownership * on MacOS, we have to use polling to see client-side changes * the HTML5 client can only access the clipboard when the browser decides it is appropriate to do so: usually following clicks or specific key combinations, it may also request permission once and this cannot be easily enabled afterwards once it has been denied * Wayland severely restricts access to the clipboard, making it impossible to synchronize it properly

Configuration Options

* `clipboard`: `auto`, `yes`, `no`, `all`, or the name of a clipboard implementation * `clipboard-direction`: can be used to restrict the direction of the clipboard data transfers. This setting is also available from the system tray menu. * `clipboard-filter-file`: can be used to filter out clipboard contents using a file containing regular expressions * `local-clipboard` / `remote-clipboard`: can be used to select which clipboard selection to synchronize with

Selections

The default auto setting synchronizes all the selections supported by the platform. On MS Windows and MacOS, auto is equivalent to all.

--clipboard=all enables every selection that the platform can handle. On Mac OSX and MS Windows clients, this adds the PRIMARY selection, which is handled as a special case since it does not exist locally:

This is implemented by PrimaryProxyMixin in xpra/clipboard/primary.py, which both platform backends share.

Technical Constraints

Clipboard support is an ongoing struggle.

You must ensure that there are no other clipboard synchronization tools already running as those are very likely to interfere and cause synchronization loops, wasted bandwidth, trigger application bugs, etc

In particular, avoid using the clipboard synchronization from your virtualization solution if you use one (ie: virtualbox, vmware, etc), or from tools like synergy. Alternatively, you can disable xpra's clipboard instead. Just avoid running both at the same time.

Debugging

Tool

There is a debugging tool which can be launched using xpra clipboard-test.

The easiest way to test the clipboard on X11 platforms is to use xclip tool to set and verify the contents of each clipboard.

Note: on win32, you will need to change the clipboard currently in use to match the one you modify, this must be done before changing the value to ensure it is propagated.

Logging

just add -d clipboard to your xpra command line.

Useful Pointers

For low level implementation details, see [clipboard subsystem](../Subsystems/Clipboard.md).
Related tickets