Copy and paste across 2 computer

Copy and paste across 2 computer - student project

I work with 2 computer, a laptop and a desktop. Both are running Linux and with the help of x2x, I control both with my laptop keyboard and mouse.
x2x works like this, you define where the remote computer is in relation to your local screen.
Eg.: My desktop monitor is located to the right of my laptop.
I have x2x installed on both computer. On my laptop I run the following command:
ssh -YC [email protected] x2x -east -to :0.0
Once the connection is established, when I move my laptop mouse to the right edge of its screen, I start to control the desktop. See video for demonstration.
While this setup is interesting when you have multiple computer. It gives you the feeling of a single computer with multiple screen.
Except for the fact that copy/paste does not transfer in between computer
Using a couple of bash script containing a few lines, I now can pass the data across easily.
The scripts assume that you are running emacs and server-mode is started. See comments in code.
Each computer starts the receiver.sh script. I recommend starting it in its separate console. It will display any new line received from the remote computer as they are received.
Once the receiver is running on each side, each side can start the sender.sh script.
This script will open a tmp file in an emacs buffer. Any lines added to the file will be sent across when the file is saved and displayed in the receiver console.
The scripts do not close nicely, when you want to stop it you have to kill tail and nc on each computer.
Code can be found here: https://github.com/ericsimard52/copypasteSocket

Eric Simard
Join us on FB
Teacher