maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Copy to Clipboard through SSH (https://talk.maemo.org/showthread.php?t=51165)

lostinmirkwood 2010-04-27 16:11

Copy to Clipboard through SSH
 
Is there a way to set the current n900 clipboard (copy/paste) through an ssh session?


A little further explanation, I make a lot of use of ssh sessions to my device and quite often I'd like to send some text (a link , get to a web page, etc.) that I have running on my laptop to use it in conversations or browser.

Is there a specific file where the clipboard resides that I can overwrite? or is this solely in memory?

Slocan 2010-04-27 17:01

Re: Copy to Clipboard through SSH
 
You can try the following bit of code. Copy this to a file (for example copy_clipboard.py), and run it like:
Code:

python copy_clipboard.py "This will be copied to the clipboard"
Code:

import gtk
import sys

arg = sys.argv[1]

def receive(clipboard, text, data):
    gtk.main_quit()

clip = gtk.clipboard_get()
clip.request_text(receive)
clip.set_text(arg)

gtk.main()


lostinmirkwood 2010-04-27 18:32

Re: Copy to Clipboard through SSH
 
wow, that felt good and worked perfectly.
I'm learning python but don't know the ins-and-outs GTK yet.

Thank you, Slocan.


All times are GMT. The time now is 19:32.

vBulletin® Version 3.8.8