Copy and paste (sort of) into the XO laptop's Terminal activity

Xo-Pbpaste

According to ticket #5376, you can't copy and paste text between Terminal.activity and other applications. This became a problem for me this evening when I tried to copy a script from a web page into a file on the XO laptop. Fortunately, pygtk gives you access to the clipboard, and it's really easy to create a script that blasts the contents of the clipboard to stdout. I named it pbpaste after the Mac OS X utility of the same name. Save this file somewhere in your $PATH, make it executable, and you're all set.

#!/usr/bin/python

import pygtk
import gtk
cb = gtk.clipboard_get(selection = "PRIMARY")
print cb.wait_for_text()

It's not as flexible as a middle-click button would be, but it gets the job done, as shown in the figure above. And if I need to insert the contents of the clipboard into a file I'm editing in vi, I can always use :r!pbpaste

Posted by Brian Jepson | Dec 20, 2007 01:58 PM
Education, Linux, olpc | Permalink | Comments (3) Bookmark and Share

Recent Entries

Comments

Newest comments listed first.

Posted by: Gary LaPointe on December 23, 2007 at 2:46 PM

So did you get your Sprint phone working as a modem?


Posted by: ajaj on December 25, 2007 at 11:59 AM

no Comment ghjgj rty tr yr yrt


Posted by: Brian Jepson on January 9, 2008 at 6:38 AM

Gary, I did finally get it working. I used the instructions here: http://www.evdoforums.com/thread3308.html


Leave a comment



Bloggers

Welcome to the Hacks Blog!

Brian Jepson.Brian Jepson


Jason Striegel.Jason Striegel


Philip Torrone.Phillip Torrone



See all of the books in the Hacks Series!
Advertise here.

Recent Posts

www.flickr.com
photos in Hacks More photos in Hacks

Most read entries (last 30 days)