I don't know how to do this, but if I needed to implement it, I would start by looking at programs that access the X clipboard like xclip (http://sourceforge.net/projects/xclip/). From there, start either reading the man pages for the X functions used in xclip or search for them on google. Some quick searches turned up this page which looks like it has some of the info you'd need: http://tronche.com/gui/x/xlib/window-information/selection.html
↧