I have a Python TUI application and I want it to save the the result of a user selection.
It's pretty easy to find a windows and mac api to copy something to the user clipboard, but how to do so in Linux from Python?
It needs to:
- work accross DE: at least gnome shell and kde.
- work on x and wayland.
- work without installing a third party package from the linux repo (such as xclip) since you can't pip install xclip. This means the pypi clipboard package is excluded since it relies on that.
- it works without loading a GUI widget that requires the user to select the content, since the copy may happen in the background or in a TUI. The text may not be selected with the mouse.
xclip does it for xwindows, so there muse be an api for that. And DE for wayland allow it, so there must be some c code I can call using ctypes maybe.