ClipboardPersistence

Differences between revisions 1 and 9 (spanning 8 versions)
Revision 1 as of 2010-05-24 19:38:04
Size: 1106
Editor: 69-165-217-17
Comment:
Revision 9 as of 2010-06-18 04:00:30
Size: 5528
Editor: 76-10-164-249
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Clipboard persistence in Ubuntu is a Google Summer of Code 2010 project. = Copy, Quit, Paste. =
||<tablestyle="float:right; font-size: 0.9em; width:40%; background:#F1F1ED; margin: 0 0 1em 1em;" style="padding:0.5em;"><<TableOfContents(2)>>||
Line 3: Line 4:
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 [[http://en.wikipedia.org/wiki/Clipboard_manager|overview]] of the issue.
Line 4: Line 6:
=== Affected Applications ===
|| Firefox ( and Thunderbird, other Xulrunner apps) || [[https://bugzilla.mozilla.org/show_bug.cgi?id=311340|Fixed]] || [[http://hg.mozilla.org/mozilla-central/rev/270a70535807|Patch]] ||
|| Evolution || [[https://bugzilla.gnome.org/show_bug.cgi?id=258374|Fixed]] || [[http://bugzilla-attachments.gnome.org/attachment.cgi?id=94407|Patch]] ||
|| Pidgin || [[http://developer.pidgin.im/ticket/391|Fixed]] || [[http://developer.pidgin.im/viewmtn/revision/info/4ced433906d17bb2758a2b010ce264314d17fe04|Patch]] ||
|| Gedit || [[https://bugs.launchpad.net/ubuntu/+bug/11334|Fixed]] || No patch found ||
|| Chromium || [[http://code.google.com/p/chromium/issues/detail?id=32291|Confirmed]], wontfix? || [[http://src.chromium.org/svn/trunk/src/app/clipboard/clipboard_linux.cc|Relevant section]] ||
|| OpenOffice.org || [[|Confirmed]] ||
|| GnuCash || [[https://bugzilla.gnome.org/show_bug.cgi?id=510205|Confirmed]] ||
|| GIMP || [[https://bugzilla.gnome.org/show_bug.cgi?id=510230|Confirmed]] ||
== 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 [[http://parcellite.sourceforge.net/?page_id=16|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 [[http://parcellite.sourceforge.net/?page_id=10|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
 * setting [[http://library.gnome.org/devel/gtk/stable/gtk-Clipboards.html#gtk-clipboard-set-can-store|set_can_store]] on clipboard contents whenever they gain ownership of the clipboard
 * saving clipboard contents on quit with [[http://library.gnome.org/devel/gtk/stable/gtk-Clipboards.html#gtk-clipboard-store|gtk_clipboard_store]]

=== Xlib ===

Xlib provides a variety of selection management functions that [[http://old.nabble.com/CLIPBOARD-selection-doesn't-save-content-td28122974.html|can be used]] to store clipboard data. [[http://michael.toren.net/mirrors/doc/X-copy+paste.txt||Here]]'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.

=== Fixed Applications ===

 * Firefox ( and Thunderbird, other Xulrunner apps): [[https://bugzilla.mozilla.org/show_bug.cgi?id=311340|Report]], [[http://hg.mozilla.org/mozilla-central/rev/270a70535807|Patch]]
 * Evolution: [[https://bugzilla.gnome.org/show_bug.cgi?id=258374|Report, [[http://bugzilla-attachments.gnome.org/attachment.cgi?id=94407|Patch]]
 * Pidgin: [[http://developer.pidgin.im/ticket/391|Report]], [[http://developer.pidgin.im/viewmtn/revision/info/4ced433906d17bb2758a2b010ce264314d17fe04|Patch]]

=== Broken Applications ===

 * Chromium: [[http://code.google.com/p/chromium/issues/detil?id=32291|Report]]: may be a wontfix, [[http://src.chromium.org/svn/trunk/src/app/clipboard/clipboard_linux.cc|Relevant section]]
 * !OpenOffice.org: [[http://www.openoffice.org/issues/show_bug.cgi?id=63092|Confirmed]]
 * !GnuCash || [[https://bugzilla.gnome.org/show_bug.cgi?id=510205|Confirmed]], but works for me
 * GIMP || [[https://bugzilla.gnome.org/show_bug.cgi?id=510230|Confirmed]] for text, works for graphics
 * Eclipse || [[https://bugs.eclipse.org/bugs/show_bug.cgi?id=317255|Confirmed]]

=== Working Applications ===

Here's a list of applications that are working but with no evidence that someone explicitly worked on a fix. They may never have needed fixing on their own because the developers involved were aware of the ClipboardManager specification, or they may be fixed by merit of using GTK+ elements such as TextBuffers that take care of clipboard management without extra developer involvement.

 * Gedit
 * Geany
 * Evince
 * Gnumeric
 * Gedit - note that the initial implementation of GSD-clipboard-manager was designed to target gedit
 * Gnu Cash
 * Getting Things Gnome
 * Okular
 * Homebank
 * Pyroom

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.

Fixed Applications

Broken Applications

Working Applications

Here's a list of applications that are working but with no evidence that someone explicitly worked on a fix. They may never have needed fixing on their own because the developers involved were aware of the ClipboardManager specification, or they may be fixed by merit of using GTK+ elements such as TextBuffers that take care of clipboard management without extra developer involvement.

  • Gedit
  • Geany
  • Evince
  • Gnumeric
  • Gedit - note that the initial implementation of GSD-clipboard-manager was designed to target gedit
  • Gnu Cash
  • Getting Things Gnome
  • Okular
  • Homebank
  • Pyroom

ClipboardPersistence (last edited 2010-08-10 06:51:00 by 75-119-229-248)