How to get selected text into a terminal command?
I want to do the following: Invoke a mouse gesture sending a terminal command to open firefox and google for whatever text was selected.
Therefore I need a way to make the command access the buffer containing selected text (the one that can be pasted by middle clicking). Is there a system variable for that? Or how do I do it?
To be more precise, if I selected the text "grub" with the mouse in any application, I need a bash command that will echo it back. Like calling a command "getmouseselection" in a terminal or bash script that will output "grub", or "echo $selectedtext" with the same output.
How can I do that?