Useful workflow for sharing clipboard with desktop computer
I love Editorial so much that I'm starting to use it as my editor of choice for writing Markdown, even replacing the one in the desktop computer (I used vim for that).
However, I miss the speed of copy&pasting of the desktop. In the iPad, selecting text to copy it from the browser, pdf readers, or any other app, is still a slow and frustrating experience. Moreover, switching tasks decreases a lot my productivity (specially since I upgraded to iOS7, which tends to restart all background tasks, probably due to memory limitations of my iPad2).
So I wrote two small pieces of software that allow me to have the best of both worlds.
Now, I have the iPad with Editoral for note-taking while browsing, reading pdfs, and researching in the desktop computer and, when I find something interesting, I can copy the text to the computer's clipboard and paste it in my notes on the iPad.
I'm so happy with this setup that I needed to share it :-) If you want to try it, you'll need:
- Python in the desktop, with module
xeroxinstalled. It works with Linux (tested), Windows (tested) and OSX (still untested).
- My clipboard server script,
copypaste.py, which you can download from: https://gist.github.com/jldiaz/8002349
- Editorial in the iPad (you have it already, don't you?)
- My Editorial Workflows Paste from remote and Copy to remote
How to use it:
- In the desktop computer, run the script
copypaste.py. Take note of the IP and port which are displayed
- In the iPad, configure the above workflows, setting the IP and port obtained in the previous step (you have to enter these values in the first action of "Paste from remote", and the last one of "Copy to remote")
- Select some text in the desktop and copy it to the clipboard (eg. Ctrl-C in Windows)
- In Editorial run the Workflow "Paste from remote" and see how the text appears in the editor. It is also stored in the system clipboard, so you can use it in other apps.
It can be run in the other direction too:
- Write some text in the iPad, select it and copy it to the clipboard.
- Run Editorial Workflow "Copy to remote"
- In the desktop computer press Ctrl-V (paste) and the text copied in the iPad will appear. Useful for sharing URLs for example.
- Python in the desktop, with module
Enjoyed your work, exactly what I needed, thanks. I suggest that you add (this is what I did) an if statement giving it a default value of 9999 and keeping the placeholders. I am suggesting this due to the fact that placeholder are not actual values.
You are right, but since you have to enter the IP anyway, I didn't thought it was neccessary to set default values. Perhaps I should have removed the placeholder value to reduce the risk of confusion.
By the way, I forgot to mention that it is possible to assign a keyboard shortcut for these actions. I use
rppfor "remote paste" (inspired by
pppwhich is asigned by default to standard paste).
I hope you have built in also some (even simple) encryption ...
I thought about it, but I didn't implement it. I don't think it is needed, since the typical usage is inside a private network (after all you need to be near both devices), probably at home, behind a wireless router which implements NAT, which makes you inaccesible from the outside. And in any case you can choose any port for the comunication, which can be seen as a kind of "pin", because both client and server need to know the chosen port.
Anyway, the kind of information I pass between the desktop computer an the ipad is not sensible information. Only text or code copied from books or websites, urls, that kind of things.
If required, basic encryption could be implemented via a shared secret that the user should type both in the client and the server. Since editorial comes without cryptographic libraries I should implement my own, so a simple algorithm like RC4 should do. I don't know if it would be possible to access the crypto functions of
paramiko, to use DES or AES. I know I could set up a proper ssh connection between client and server, but that seems overkil...
I was wrong about python Editorial not including cryptographic libraries.
Cryptomodule is available, and I did some tests for using AES with SHA256 checksums to provide basic authentication (via a shared secret) and confidentiality. It works well.
However, adding this to my simple Workflows would require additional setup both in the client and server, and more computational power used . I still think that for private local networks it does not worth the pain.
I guess I could release two different versions, with and without encryption, so that each user can choose depending of its needs and environment. Anyone would be interested in the secure version?
I do not see any need for a secure version, but I'd like to be able to implement sharing clipboards more easily with multiple computers (not only iPads), right now I use three to three different devices daily and they all use different operating systems (linux, macs, and ipad), what they all have in common is some type python implementation.
It is easy to share between different computers using the iPad as a brigde. You only need to run the server in each computer (linux, mac), and then duplicate the workflows in the iPad to have different configurations (IP and port of each server). You can rename these workflows with names such as "Copy from linux", "Paste to mac", etc.. to avoid confusion.