gpm - the other clipboard buffer
#95 Henry, Friday, 25 March 2011 1:48 PM (Category: UNIX Tools)
(Tags: gpm clipboard buffer)

I was discussing the new Firefox 4 behaviour in a mailing list, and I wrote this and wanted to preserve it. So here it is:

Way back in the day, when Linux was new and exciting and very primitive, we didn't use X much at all. We used the text consoles. Alt-F1 to Alt-F6 and we switched between them and did our multi-tasking that way. It worked nicely.

There were a number of ways of using a mouse back then, but one daemon had great promise - gpm. This little program had one feature that we loved. You could be in one console and have typed a massively complex command, and you could take your brand new mouse and highlight that command. Then you would Alt-F2 to the next console where you were logged into some remote computer, and you would middle click on your mouse (or if you only had a two button mouse you would simultaneous left and right click to emulate the middle button) and your massively long command would be pasted to the command line and you could edit it and press Enter. It was magic.

And when it went to hell and you got an obscure error message, you could use gpm again and highlight a swathe of text on the console including your command and all the error messages, switch back to another console (Alt-F3) and write an email to the developer or packager or Patrick Volkerding, and paste all that highlighted text into your email and send it off to him for help.

Then we started using X a lot more and instead of being at those six consoles, we started using xterms. And we found that gpm would still let us capture blocks of text in the xterms by highlighting it (copy) and middle-clicking somewhere else (paste). We could do this between xterms, and even with some graphical programs. And if we did switch back to the consoles with Ctrl-Alt-F1 to Ctrl-Alt-F6 and run things at the command line (which we can still do today) and highlight text there and then switch back into X with Alt-F7, and paste it back into our graphical windows. gpm was so good at this that it won the mouse wars and is the program mostly installed on Linux boxes to handle the mouse. It's still there today, hidden behind your slicky clicky interface.

I still use this gpm method for reproducing commands between xterms, and I still flip to the console occasionally to see errant behaviour. I use it to document the result of commands. One other benefit is that if you spot a URL in a document (say you go back to your collection of funny Usenet messages, and you see a URL in one of them and you wonder if that URL still exists after 25 years, so you highlight it with your mouse and you take it your browser and middle-click in the URL box and press Enter, and discover that time claims all things, even funny websites. You're using that copy-and-paste feature of gpm.

And somewhere in history, the browsers learnt about the middle-click buffer of gpm and took it one step further. They allowed the contents of the gpm buffer to load a page if it was pasted into the body of a page. More magic.

I still use these gpm features all the time. And I am grateful that gpm does it for me.

0 comments