ClipboardPersistence

Revision 8 as of 2010-06-18 01:35:21

Clear message

Copy, Quit, Paste.

Clipboard persistence is a bug that affects many programs under Ubuntu and other X11-based operating systems. Fixing it is a Google Summer of Code 2010 project. Wikipedia has a good overview of the issue.

The problem: data loss on quit

If you copy something from an affected application and then close it, you'll have an empty clipboard.

Workaround: Clipboard Managers

If you want to fix this problem on your machine, you can install a clipboard manager that should solve it. I recommend Parcellite. It's available in the universe repositories, and you can install it with:

 sudo apt-get install parcellite 

When you restart your computer or run it manually from Programs>Accessories>Parcellite, you'll have a panel applet that quietly saves a history of all your copies. You won't have to go look at the history to resurrect your copied text. Copy, quit, paste should just work.

Parcellite is also available for other distributions.

Similar programs include

  • Klipper, a part of KDE
  • Glipper, an alternative for the Gnome environment
  • Clipman, for XFCE

Development

Why does this happen?

The problem happens because Xorg takes a conservative approach to copying. It copies only a reference to the original data when the user performs a select or copy. It doesn't go and retrieve the actual data from the source program until the user requests a paste. It saves a lot of unneeded transfer of data this way, at the expense of having no way of retrieving data from a closed program that hasn't saved its clipboard somewhere else.

How to fix it: the ClipboardManager spec

Freedesktop's ClipboardManager specification comes to the rescue. Gnome settings daemon, the component of Ubuntu that handles all copying and pasting by default, conforms by allowing applications to explicitly request to save their clipboard contents in a safe place. Applications conform by requesting a save before they exit. Everything gets squared away before a quit and we don't lose any data.

GTK+

Pure Gnome applications that use standard features like TextViews are automatically supported.

Applications that use GTK+ features can provide persistence by

Xlib

Xlib provides a variety of selection management functions that can be used to store clipboard data. http://michael.toren.net/mirrors/doc/X-copy+paste.txt's a great introduction to Xlib clipboard functions, but be aware that the document is twelve years old and written before the existence of the ClipboardManager specification.

The state of things

There are very few applications that conform to the ClipboardManager standard, and we believe that few developers are even aware of the problem. It has notably been fixed, however, in Firefox, most Gnome applications, Evolution, and Pidgin.

SoC

There is currently (2010) a Summer of Code project for Ubuntu devoted to fixing the problem. Please contact SarahStrong for updates.

Affected Applications

Firefox ( and Thunderbird, other Xulrunner apps)

Fixed

Patch

Evolution

Fixed

Patch

Pidgin

Fixed

Patch

Gedit

Fixed

No patch found

Chromium

Confirmed, wontfix?

Relevant section

OpenOffice.org

Confirmed

GnuCash

Confirmed

GIMP

Confirmed

Eclipse

Confirmed