Changing Clipboard Data From The Shell

Changing Clipboard Data From The Shell
When you use the copy and paste function on your Pre the string has to go somewhere. Right? Well, from what I learned from tharris which was that the string goes to a file called webkit-clipboard which is located in the /tmp directory.

Manual Steps
Step One: Access the Linux portion of your Pre

Step Two: Edit your clipboard file (you need to at least copy and paste something once for the file to show up)

vi /tmp/webkit-clipboard

Step Three: Save it.

Tip: for more info on how to use vi, remember Google is your friend...

By: JRG

WebOS Clipboard Buddy
WebOS Clipboard Buddy is a very simple pyGTK app that allows you to easily copy data between your desktop's clipboard and the Pre's clipboard. Feel free to improve upon it. Currently this is Linux only, though it should be trivial to get working under windows. It currently requires that you have the SDK installed (specifically that novacom is functional and available at /usr/local/bin/novacom/novacom).


 * 1) !/usr/bin/env python


 * 1) Copyright (c) 2009 James Hines


 * 1) Permission is hereby granted, free of charge, to any person
 * 2) obtaining a copy of this software and associated documentation
 * 3) files (the "Software"), to deal in the Software without
 * 4) restriction, including without limitation the rights to use,
 * 5) copy, modify, merge, publish, distribute, sublicense, and/or sell
 * 6) copies of the Software, and to permit persons to whom the
 * 7) Software is furnished to do so, subject to the following
 * 8) conditions:


 * 1) The above copyright notice and this permission notice shall be
 * 2) included in all copies or substantial portions of the Software.


 * 1) THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * 2) EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * 3) OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * 4) NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * 5) HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * 6) WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * 7) FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * 8) OTHER DEALINGS IN THE SOFTWARE.

import gtk import pygtk import commands from subprocess import *

DEBUG=True

def quit_cb(widget, data = None): if data: data.set_visible(False) gtk.main_quit def popup_menu_cb(widget, button, time, data = None): if button == 3: if data: data.show_all data.popup(None, None, None, 3, time) pass

def pre_to_clipboard_cb(widget): clipboard = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD) result = commands.getstatusoutput('/usr/local/bin/novacom/novacom get file:///tmp/webkit-clipboard') if DEBUG: print result text = result[1] clipboard.set_text(text)

def clipboard_to_pre_cb(widget): clipboard = gtk.clipboard_get(gtk.gdk.SELECTION_CLIPBOARD) clipboard.request_text(push_to_pre)

def push_to_pre(clipboard, text, data): pre = Popen(, stdin=PIPE, stdout=PIPE) pre_output = pre.communicate(text) if DEBUG: print pre_output

def about_icon_cb(widget, data = None): msgBox = gtk.MessageDialog(parent = None, buttons = gtk.BUTTONS_OK, message_format = "WebOS Clipboard Agent\nVersion 1.1.0\nCopyright 2009, James Hines.") msgBox.run msgBox.destroy statusIcon = gtk.StatusIcon menu = gtk.Menu menuItem = gtk.MenuItem(label = "Copy from Pre") menuItem.connect('activate', pre_to_clipboard_cb) menu.append(menuItem) menuItem = gtk.MenuItem(label = "Copy to Pre") menuItem.connect('activate', clipboard_to_pre_cb) menu.append(menuItem) menuItem = gtk.SeparatorMenuItem menu.append(menuItem) menuItem = gtk.ImageMenuItem(gtk.STOCK_ABOUT) menuItem.connect('activate', about_icon_cb) menu.append(menuItem) menuItem = gtk.ImageMenuItem(gtk.STOCK_QUIT) menuItem.connect('activate', quit_cb, statusIcon) menu.append(menuItem) statusIcon.set_from_stock(gtk.STOCK_PASTE) statusIcon.set_tooltip("WebOS Clipboard Agent") statusIcon.connect('popup-menu', popup_menu_cb, menu) statusIcon.set_visible(True) gtk.main