Clipboard Management that Works

May 07, 2005

It is incredible how few Linux users really appreciate the power of the X clipboard. Most people get tripped up using clipboard management in Linux trying to do things the Windows way. By default, the X clipboard captures the current mouse selection rather than waiting for a Ctrl-C command. Because of this feature, most people end up losing their selection prematurely. Another hurdle is that the selection is dropped when the application that created it is terminated.

After hearing a rant on LugRadio about broken clipboard management in Linux, I wrote in with the following response:

I believe that the concern is well founded. Clipboard management in Linux is totally botched. The problem is that once the application holding the clipboard contents quits, the content is flushed from the primary buffer. However, if you are running a super-daemon, such as KDE's Klipper, which is just brilliant by the way, the clipboard content stays alive even after the death of the application. In fact, it can keep up to 25 of the most recent selections. If you have never taken advantage of this feature in Klipper, you are really missing out!

KlipperRegardless of which desktop you choose, you should definitely give Klipper a try. Klipper allows you to keep several selections in memory which you can then use to toggle with the primary buffer. There are several other clipboard implementations, but they all pale in comparison to Klipper. In a followup to my original post I highlighted a few reasons why it is better:

  1. Klipper is simply good at what it does. It can pull from both the xselection and the copy buffer and it does a very good job at keeping the history ordered properly and in sync.
  2. Klipper is compliant with the freedesktop.org standard for dock applets.
  3. Klipper can retain clipboard contents between logins using KDE's session management.
  4. Klipper can perform actions on the clipboard contents (though I don't really use this feature).
  5. Klipper is accessible through dcop.
  6. Klipper can popup anywhere, not just out of the docklet icon.
One feature that I really wish Klipper had is the ability to "freeze" an item. This would be immensly helpful for storing usernames, passwords or form data temporarily.

If you still aren't convinced as to why we need a clipboard manager, try one for a few days and then attempt to go back. Nothing sucks worse then when you select something into your xselection, then accidently select something else and then are surprised when you go to paste that email you copied and get an endline instead. I do realize the Klipper is essentially a hack, since it acts as a vacuum cleaner to suck up all selections wherever it finds them. Perhaps a better solution should be developed in the future. But, until there is an alternative, you are going to have to pry Klipper from my dead body if you want to take it away from me, because Linux is unusable without it. Even now that I run Gnome, I still have Klipper kicking in my panel.

Posted at 04:30 PM in Linux | Permalink Icon Permalink

4 Comments from the Peanut Gallery

1 | Posted by Irritated on November 23, 2005 at 10:08 PM EST

Never used klipper, but does it enable copy/pasting of non-textual object? Like what if I want to copy a part of a diagram from Dia to a presentation in OOImpress, can I do that? I don't think it is possible. Anyone who written a quick presentation or document using web resources would miss IE-Word copy/pasting flexiblity.

How does Windows application implement this? DDE? What is the standard way of doing it in Linux?

2 | Posted by Dan Allen on December 08, 2005 at 04:45 PM EST

In the latest version of KDE (if you don't have it, go grab Kubuntu), klipper can handle objects as well as text. Unfortunately there is no standard in Linux for doing such a thing, but I commend KDE for pushing forward and doing their best to slurp up what objects are available and allow them to be pasted into any application.

Apparently the new version of Gnome has a "fixed" clipboard, but still, I doubt it can hold a candle to klipper.

3 | Posted by DblD22 on August 04, 2006 at 12:57 AM EST

The windows program Clipcache is an example of what is needed on Linux. It can save clips indefinately, organize them in groups, and allow them to be backed up since they are saved in a file. Great for frequently used email addresses, blurbs of text frquently used, and of course the already mentioned login data.

4 | Posted by Dan Allen on August 28, 2006 at 11:27 AM EST

I agree. One of the features that klipper still lacks is the ability to "freeze" an item. Of course, if it had all the features of Clipcache, I would never need sticky notes anymore, since effectively the two applications would be merged into one. The gnome clipboard tried to implement a more editor-like interface, but it was very clunky at best.

I see that Clipcache also has a text cleanup feature. That would be extremely helpful to have when editing web pages that cannot use special characters inserted into the text by office applications.

Definitely some good ideas!