Hello I'm writing a c++ program and I need to get what's on clipboard into a string variable. I found a lot of solutions but all of them were written for windows. Is there any method without using the QT libraries? I found something related to X11 but not very explicit aswell.
Thank you very much
Did you try to find not a code first but a program with an implementation ? I did it for you and found a lot of implementations which use direct X11 calls. I think the most valuable is this but also you may read this. Just find any program and look for the sources. Try to look on wikipedia what applications use x11 clipboard/selection system.
The following programs specifically operate on data transfer mechanisms:
xcutsel
transfers data from selections to cut buffers or vice versa
xclipboard
,glipper
(Gnome),parcellite
(LXDE), andklipper
(KDE) are clipboard managers, maybewmcliphist
as wellxcb
shows the content of the cut buffers and allows the user to manipulate them xselection,
xclip
,xsel
andxcopy
are command line programs that copy data to or from the X selection. xcopy has a verbosity option that helps debug X selection issues. parcellite also has the ability to read from and write to specific X selections from the command line.
synergy
is a cross platform tool that allows you to share a clipboard across multiple computers running multiple operating systems
xfce4-clipman-plugin
is a "clipboard history plugin for the Xfce4 panel" and also a clipboard manager xtranslate looks up words in the Xselection in a multi-lingual dictionary autocutsel syncs cut buffer and selection buffer
Shortly, in theory, X11 has 2 "clipboards": actually a keyboard and for selections - the text you selected immediately can be pasted anywhere you want by pressing middle-mouse button while actual "keyboard" is made for main/default clipboard purposes as exchange by different kind of objects.
P.S. I'd not work with x11 anymore after my experience. Enjoy :)