I'm trying to build a script that will add the currently selected text to the end of a file. So far it looks like cat selected_text >> quotes.txt.
Is there any way, either in command line or in C/C++ to get the currently selected text from the currently active window?
Take a look at the xclip command
This command operates on X11 selections (the middle-click paste clipboard). It can be used to retrieve the last block of text that was selected using the mouse.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With