[Annoyances] X-Windows Copy & Paste

Richard Boulton richard at tartarus.org
Wed Aug 20 02:09:28 EEST 2003

I've found this a most interesting discussion.

To summarise, my understanding is that applications should set PRIMARY to
the contents of the selection whenever it is modified, and set CLIPBOARD
only on an explicit user command.  Whenever CLIPBOARD is set, PRIMARY should
also be set to the same thing (but this probably happens implicitly anyway,
since the usual way to set CLIPBOARD involved making a selection first).

Applications should paste from CLIPBOARD if an explicit paste is done (eg,
from a menu), but may support an alternate method for pasting from PRIMARY,
such as middle button click.  CLIPBOARD is the copy&paste mechanism that
must be implemented to ensure interoperability with all applications -
therefore applications must simply provide some means of setting CLIPBOARD
in order to be able to paste into all other applications.

The "explicit action" to set CLIPBOARD could be a keyboard shortcut, a
toolbar menu option, a context menu option, or possibly something else, as
long as it is an explicit step that the user takes to perform the copy.
CLIPBOARD should not be set simply by making a selection, since this is too
destructive of data deliberately copied by the user.

The only time it would be excusable to set CLIPBOARD on selection without
an explicit action would be if there was absolutely no way that such an
action could be built into the UI.  However, I don't know of a situation
where this is the case: for a terminal application for example, at least
one of a right-click context menu or a keyboard shortcut would be

An appropriate patch to Pterm to make it support the above would be:
 * Leave the current behaviour of setting PRIMARY on selection with the
   left button, and pasting from PRIMARY on the middle button.
 * Add context menu options for "cut" and "paste", which work only on
   CLIPBOARD, and have no interaction with PRIMARY.

This seems neat, and hopefully avoids confusing users.  It also avoid the
risk that when I'm pasting from one pterm to another I slip and press the
wrong mouse button (particularly common when using "emulate 3 buttons"),
and lose my selection.

I think I've got it clear enough in my head I can write a patch now, and
convince the maintainers to accept it.  Thanks for that.


More information about the xdg mailing list