cdown / clipmenu

Clipboard management using dmenu
MIT License
1.1k stars 90 forks source link

Notifications about clipboard access #210

Closed timhae closed 4 months ago

timhae commented 10 months ago

Hey, thanks for the great tool! I recently wanted to investigate which programs read from and write to my clipboard. I got up to this bpftrace script:

sudo bpftrace -e 'uprobe:/var/lib/libX11.so.6.4.0:XConvertSelection{time("%H:%M:%S ");printf("%s,%s,%s,%s,%s\n", curtask->comm, curtask->parent->comm, curtask->parent->parent->comm, curtask->parent->parent->parent->comm, curtask->parent->parent->parent->parent->comm);}'

but this way I can only see xsel, clipmenu and systemd:

21:15:25 xsel,timeout,.clipmenud-wrap,.clipmenud-wrap,systemd

which is intended I would assume since clipmenu is my clipboard manager. Is there any place I could get this information from in the source code? Or do I have to do that on xsel's end? Ideally I would like to send desktop notifications on clipboard access.

cdown commented 4 months ago

Hey, in clipmenu 7, you can look at SelectionRequest events in clipserve:

https://github.com/cdown/clipmenu/blob/70cc5d2b6a2027ba186f1555c0e114c53dc7c578/src/clipserve.c#L45

Closing since discussing that here more is probably out of scope, but good luck!