Hacker News new | comments | show | ask | jobs | submit login

X11 actually maintains three separate cut/paste buffers - primary (which you access with select/middle click), secondary and clipboard. Ctrl-C/Ctrl-V are probably interfacing with the X11 clipboard, not a distinct Gnome clipboard. (Though I don't use Gnome myself, so I can't check.)

You could probably write a daemon to keep the primary selection empty. The `xsel` program would be a good place to start. I thought you could do it with `while true; do echo -n '' | xsel -n -i; done`, but it quits immediately if the input is empty so that would be constantly executing a new program. Still, I expect there's some trickery you could do with it, or you could look at how it's implemented and copy that.

(edit - or to eliminate a lot of the pain,

    while true; do echo -n ' ' | xsel -n -i; done
will keep a space permanently in the selection. I tested and it seemed to work, though there may be edge cases I'm not aware of.)

Gnome and KDE both use the freedesktop.org clipboard manager specification, not the X11 clipboard. After copying text A with ctrl-c, then selecting different text B, the X11 clipboard (xsel -b) is empty and the primary selection (xsel -p) is B.

The major advantage this has over the X11 clipboard, IMO, is that text persists after its source application is closed.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact