DEV Community

Ishan Goel
Ishan Goel

Posted on

Copy on one device and paste on any other

Sometimes you want to share stuff between two computers. You email it to yourself and then you log on to the other computer and then you find that you forgot your email password and then you click "forgot password" and then you enter the one time code and then you make a new password and then you find the email and then you finally copy the text and get on your way.

It took you 10 minutes just to get some text from one computer to the other.

Then, you wonder - "What if, what if I could directly copy it to the other computer? It would take 3 seconds then."

Apple users might know that you can copy and paste between devices. Well, now you can do that with Android, Linux and Windows devices too! (macOS as well, of course!)

I made Uniclip. It's a CLI tool that lets you copy on one device and paste on another. You can even connect multiple devices all at once so you can have sort of a "shared clipboard" between all of them.

Install

If you're on macOS, you can install it with

brew install quackduck/tap/uniclip
Enter fullscreen mode Exit fullscreen mode

if not, simply fetch an executable from releases and install it to somewhere in your $PATH

For Android, you'll also need to install the Termux app. Termux lets you have a command line interface.

Now install the Termux:API app from the Play Store so we can access the clipboard. Then, install the Termux:API package from the command line using:

pkg install termux-api
Enter fullscreen mode Exit fullscreen mode

That's it!

Using it

To use it, we start up like so:

foo$ uniclip
Starting a new clipboard!
Run `uniclip 192.168.86.24:51607` to join this clipboard

Enter fullscreen mode Exit fullscreen mode

Now, on your other computer (or computers), we run:

bar$ uniclip 192.168.86.24:51607
Enter fullscreen mode Exit fullscreen mode

That's it! Your clipboards are now connected to each other. Try copying on one device and pasting on the other.

Now because Uniclip works by sending messages over a connection, your clipboard may be visible to attackers. To encrypt your clipboard while sending it, you can use the --secure option:

foo$ uniclip --secure
Password for --secure: 
Starting a new clipboard!
Run `uniclip 192.168.86.24:51607` to join this clipboard
Enter fullscreen mode Exit fullscreen mode

Uniclip now asks you to set a password which will be used to encrypt and decrypt your clipboard.
Then, on the other computer:

bar$ uniclip --secure 192.168.86.24:51607
Password for --secure: 
Enter fullscreen mode Exit fullscreen mode

You must enter the password you set earlier for your clipboard to decrypt.

If you liked Uniclip, consider giving it a ⭐️: github.com/quackduck/uniclip

Top comments (2)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.