Linux and it's schizophrenic clipboards
Posted on: 02 October 2010
I've been using Linux as my main development environment for a couple of months new (full details over here). The transition has been pretty easy on the whole, but I've been struggling with one of the most basic tasks - copying and pasting.
For historical reasons, Linux has two ways of copying and pasting:
- select text using the mouse to copy it, then middle-click (or left and right click together) with the mouse to paste it
- select text, then press Ctrl-C to copy it, then press Ctrl-V to paste it
It is important to understand that these methods both use different clipboards. Once I'd got my head around that, I was quite happy copying and pasting stuff around.
My happiness came to an abrupt end when I started using Keepass v2 for storing all my passwords. I'd previously been using KeepassX on Linux and Keepass v1.x on Windows, as they use the same database format, so I can access my passwords across different platforms. However, our development team at work has now grown, and we need the improved sharing and synchronisation support of Keepass 2. There is no Linux version of Keepass 2, but as it is a .Net application, it can run under Mono just fine, so that's what I've done.
The trouble started when I tried to copy a password from Keepass, and paste it into a Putty SSH window. Unfortunately, Keepass (or perhaps Mono) only copies the password on to the second clipboard, but Putty can only paste from the first clipboard.
After a few days of using an intermediary which can use both clipboards (i.e. copying from Keepass, pasting into gEdit, copying from gEdit, then pasting into Putty) I decided there must be a better solution. And thanks to a little help from Superuser there is, in the shape of autocutsel. It's in the Ubuntu repository, so a quick apt-get, and I am once again happily copying and pasting, including my passwords into Putty!