Android and Linux

Sunday, October 3, 2010

Android to Linux clipboard, again

(Note: I did a more complete write-up on the XDA forum which may be easier to follow than this.)

Using Tasker, my previous method can be improved and, unlike pasting from the PC to phone, this one works perfectly because it's not limited by Tasker's inability to read an entire file.

Using the link above, get the computer ready with the "n1_to_comp" script, then make a little script on the phone:
#! /system/bin/sh
cat /sdcard/tohomeclip | ssh USER@IP -i /PATH/TO/SSHKEY 'n1_to_comp'
In this example, I'll name that script "2homeclip."

Here is the Task to set up with Tasker:

1- Write File > tohomeclip > text %CLIP
2- using the Locale Execute Plugin execute @! 2homeclip

That's it!

How are this post and the last one an improvement? If it's not clear, it's my fault for having a messy blog, but if you click the link above then click the link at the top of that post, you'll see that copying and pasting in the terminal previously needed an intermediary app that could save the clipboard in a plain text file. And doing it in a terminal wasn't my goal. I wanted to share clipboards system-wide. Since Tasker can interact with the clipboard and run scripts, we can do away with that other app.

But isn't it still using an extra app? Yes and no. Tasker is required, but it can do everything I wanted. Where it previously required running the script and opening the other app to interact with the clipboard (or vice-versa) by setting up these two copy/paste tasks as two widgets (or one widget which pops up both and allows you to pick), copying and pasting between the computer and phone only requires a single click.

Followers