send text to clipboard

Having some text that I want to send to clipboard, something like
string "random text", I want to call some function (C or 3rd party lib or can be Ubuntu tool)
so it would be possilbe to push Ctrl+V to paste random text

Thanks in Advance, I've googled and tried all possible options
Qt Clipboard lags, xdotool can do only paste.

There are might be X11 or libevdev, vendors I already use in my project, but I could not find relevant sample
I use for messing around with the clipboard from the command line.

Are you OK with trying out SDL?
SDL2 has these functions, and an SDL_Event structure if you want to catch a drag&drop event.

SFML also has clipboard support, something I didn't know.
It looks like the modern default Ubuntu does not come with a clipboard manager. That's partially the reason that clipboard data is deleted when a window is closed, X11 ties clipboard data to the window. While it's possible for a window to push the data to a new owner, I've never noticed any program that knows to do that.

You might want to try downloading a clipboard manager, the lack of one might be the reason that QT clipboard is having trouble. Looks like CopyQ is Qt based.
Last edited on
Registered users can post here. Sign in or register to post.