Last active
March 6, 2025 07:04
-
-
Save bketelsen/27c2cd5b1376e72e240321baa0fbc81a to your computer and use it in GitHub Desktop.
how to use lemonade to share a clipboard between remote computers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on local and remote machine: | |
go get github.com/pocke/lemonade (if you have Go installed, if not download lemonade binary from github) | |
make sure $GOPATH/bin is in your path on both machines | |
-- or move $GOPATH/bin/lemonade to a place already in your path like /usr/local/bin | |
on your local machine add a script like this: | |
cat ~/bin/remote | |
#!/bin/bash | |
ps cax | grep lemonade> /dev/null | |
if [ $? -eq 0 ]; then | |
echo "lemonade is running." | |
else | |
echo "lemonade is not running." | |
nohup lemonade server & | |
fi | |
ssh -R 2489:127.0.0.1:2489 remote.server.com | |
then chmod +x ~/bin/remote | |
when you type `remote` it will open lemonade server locally, ssh tunnel the lemonade clipboard port. | |
locally (like on my mac) cmd-C to copy something. | |
this works between any two computers, even if one of them is a vm on the same machine | |
remote - $> lemonade paste | |
OR use the amazing neovim which has built-in lemonade support and just type "p" in neovim to paste the contents | |
of your local clipboard to your remote neovim session buffer. | |
for bonus points, modify the script to use a variable to invoke it with the remote server name: | |
$ remote my.server.com |
incredible. thx
Instead of that ssh command, you can add this line to the servers in your ssh config:
RemoteForward 2489 localhost:2489 # Lemonade
and just start the server in your .bashrc
. Then you can keep using ssh as before.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot! This really helps me!