Hacker Newsnew | comments | ask | jobs | submitlogin
philh 1367 days ago | link | parent

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.)

jmillikin 1367 days ago | link

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.


Lists | RSS | Bookmarklet | Guidelines | FAQ | DMCA | News News | Feature Requests | Bugs | Y Combinator | Apply | Library