This is my personal blog. The views expressed on these pages are mine alone and not those of my employer. This is not AI. All hallucinations are my own human ones.
Clipboard sniffer
Yes clipboard, not keyboard. I’ve made a clipboard sniffer for X called ClipSniff.
It periodically saves whatever is in the clipboard (both the “PRIMARY” and the “CLIPBOARD”) into a sqlite database.
git clone http://github.com/ThomasHabets/clipsniff.git
It wasn’t that hard when you knew where to look. You just:
- Connect to the X server.
XOpenDisplay() - Create a window (you don’t need to display it).
XCreateSimpleWindow() - Ask the X server who owns the PRIMARY and CLIPBOARD atoms, and ask
that window to send you the data.
XInternAtom(),XConvertSelection() - Wait for the reply event. Loop of
NextEvent()
Helpful links when coding Xlib
disqus has started showing ads. :-(
Showing (probably incomplete) comments in a static read-only view. Click button to be able to leave comments.