9 Jan 2005 pvanhoof   » (Master)

Tackling the many problems I have with clipboards on the current UNIX desktop

I got myself interested in clipboards again. I kinda lost my interest while trying to maintain gnome clipboard manager a few years ago. The clipboard of X has lots of problems which I wanted to tackle by doing a clipboard manager.

I didn't succeed for the simple reason that the X clipboard wasn't very accesible. For example to know when another xclient became the owner of the current clipboard, you had to make sure you (as a clipboard manager) had to own it at all times. By stealing it from the new owner and claiming ownership. Simply because the only event available was "you have lost the ownership". Well actually, I did succeed in creating it. But I didn't in making it actually being used. For the application itself was ugly clumbsy and needed to perform horribly ugly tricks to get it's job done.

The new xfixes extensions, however, make it possible to know about clipboard-owner changes more easily. Therefor some common clipboard manager tasks can be done more easily today. I'd like to create a common clipboard manager daemon that can be shared by different popular desktop environments.

Some of the tasks such a clipboard manager could do:

  • Make the clipboard persist when an xclient who's owning the clipboard is about to die
  • Make the clipboard persist between X sessions
  • Create a clipboard-history
  • Share clipboards between different hosts

I also want to tackle the problem that an xclient needs to first deliver it's clipboard to the xserver when another xclient is requesting it. While often both xclient processes are running on the same host, the xserver isn't always. It makes sharing larger clipboards, in such a situation, a very network intensive job. It causes lots of network-traffic. And honestly, it's slow. In my humble opinion, it would be better to utilise an Inter Process Communication mechanism. An added advantage would be that sharing the clipboard between non xlib applications and xlib applications could take place much more easily. Today this is only possible while utilising a clipboard manager or an xclient like xterm which will copy it to the console-window it's displaying, as if it's being typed by the user. Imagine vi supporting pasting the HTML-source behind the selected text of your Firefox instance without the need for first going to the source of the website you're viewing. Imagine two instances of vi copy and pasting to each other in both directions without the need of temporary files (which is more or less how mcedit does it). Imagine copy and pasting on the console as easy as today on X.

One problem with implementing such an idea was the fact that there wasn't an IPC-system being liked by the programmers of the popular desktop environments. For example KDE preferred to use DCOP whereas GNOME preferred ORBit. Today, however, a new such mechanism is being designed just for the purpose of desktop inter process communication by the freedesktop.org organisation: DBUS.

We have all the ingredients to implement these idea's. I am working on a very first piece of testing code here. For non-programmers there's nothing interesting to see there at this moment.

There's a discussion about this going on at the xdg mailinglist of freedesktop.org.

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!