Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linux clipboard read/write in C

I done lots of googling but I am still unsure on how to proceed.

What's the most common way of reading/write to the clipboard under Linux? I want both support for Gnome & KDE desktops.

Updated: do I take there isn't an easy solution and one must "aggregate" together multiple sources (gnome, kde) in order to craft a solution?

like image 951
jldupont Avatar asked Nov 26 '09 00:11

jldupont


2 Answers

Maybe you can look at xclip and see how they have done it.

It provides an interface to X selections ("the clipboard") from the command line. It can read data from standard in or a file and place it in an X selection for pasting into other X applications. xclip can also print an X selection to standard out, which can then be redirected to a file or another program.

like image 167
Johan Avatar answered Oct 21 '22 11:10

Johan


I might be shooting myself in the foot, but this could give you a hint on how to do the clipboard for kde, not sure about Gnome myself but try it, the script is in python and demonstrates how to get/set stuff on the clipboard, via using dcop and klipper, it is on this site here.

Hope this helps, Best regards, Tom.

like image 23
t0mm13b Avatar answered Oct 21 '22 13:10

t0mm13b