For example, if a python script will spit out a string giving the path of a newly written file that I’m going to edit immediately after running the script, it would be very nice to have it directly sent to the system clipboard rather than STDOUT.
For example, if a python script will spit out a string giving the path
Share
You can use an external program,
xsel:With
xsel, you can set the clipboard you want to work on.-pworks with thePRIMARYselection. That’s the middle click one.-sworks with theSECONDARYselection. I don’t know if this is used anymore.-bworks with theCLIPBOARDselection. That’s yourCtrl + Vone.Read more about X’s clipboards here and here.
A quick and dirty function I created to handle this:
You can also try pyGTK’s
clipboard:This works with the
Ctrl + Vselection for me.