Sharing Clipboard between Windows and Ubuntu (Linux) Using Python
SummaryThis python program will allow the sharing of clipboard (cut/paste) between 2 work station running Windows and Linux.
OverviewAt work, I use Windows for most of the daily work, email, Lync, Skype, word processing, Excel etc. I use a Linux box for compiling Android OS images. Often, there is a need to cut/paste contents between these 2 work stations.
Searched the internet, but could not find a very good way to do the job efficiently. So I wrote this Python script clip.py (Click to download).
How to Use the ScriptAll commands are executed in console windows. Once installed, there are 3 command options:
clip.py /s -- Send clip board contents to the remote computer
clip.py /r -- Read the contents just sent by the remote computer
and place on the local clipboard
clip.py /d -- Daemon mode. Once running, the remote and local
clipboards are automatically synchronized.
Installation
| PC | UNIX |
|---|---|
| Install Python | Python |
| Install cygwin . Make sure you can run > scp > getclip | Requires xclip $ sudo apt-get install xclip |
| ssh client. Make sure you can access > ssh | ssh client,server |
|
Edit your %userprofile%\.ssh\config file and add the ssh server |
Get IP address: |
|
Make sure you can connect to the Ubuntu machine: > ssh Unix_ssh_name | |
| copy clip.py into a folder that is in the Windows exe search path, for example, c:\apps\cygwin\bin |
copy clip.py
into a searchable folder, for example, ~/bin $ chmod 755 clip.py |
| C:\temp folder is needed to place temporary files | Temp files are placed in /home/user |
Download
Program source code: clip.py
Notes
- When you run for the first time on PC, you need to enter Unix_UserName@Unix_ssh_name
- The settigns are saved in .ssh/remote_clipsvr.txt. If you want to change server later on, delete file and run clip.py /s
- On Unix side, highlight text to select, then run clip.py /s to send. To paste, use middle-button click.