Skip to content

Python program to sync clipboards over Bluetooth serial ports. Large-button UI for accessibility.

Notifications You must be signed in to change notification settings

zqr10159/BlueClip

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BlueClip

Python program to sync clipboards over Bluetooth serial ports. Large-button UI for accessibility.

Introduction

Blueclip synchronises clipboards over bluetooth. Sync can be manual or automatic. If auto sync occurs when when the clipboard changes on one computer causing the change is sent to the clipboard on the other computer and so the programs can be minimised in the background and synchronisation will happen with no further user action.

Multiple pairings can be set up but only one is chosen as the active one at any given time. A typical setup would be a one-to-many arrangement with the central device choosing which target to send to, one at a time.

Large buttons are displayed for easy accessibility and for people who use eyegaze control.

Why bluetooth sync? There are many utilities to sync clipboards over local area networks but these suffer from a number of disadvantages. If devices are on different subnets (e.g. one wired and one wireless) it can be hard to configure connections through firewalls & routers. Cloud based commercial solutions introduce other problems or can be too complex as they add other functionality. The Windows operating system has a built-in clipboard sync feature but this requires signing into a Microsoft Account which isn’t always desirable and not possible on some kiosk-style devices. Bluetooth allows repeatable local fixed connections to be pre-configured which are independent of internet connectivity and not tied to network login accounts etc.

Installation

Copy all the files to a suitable location (e.g. c:/program files/BlueClip/) and create a shortcut for the .exe file if desired. Blueclip runs from any location but keep all its files together in one folder.

Configuration

image

  1. Create a Bluetooth pairing between your devices in the normal way
  2. Setup bluetooth serial connections. On one machine create an incoming serial port which waits for a connection. on the other machine create an outgoing serial port that calls the incoming port on the first machine.
  3. Edit the .ini files on each machine to tell BlueClip which ports to use.

Windows 10

On Machine #1: [This machine becomes a Listener waiting for connection]

Bluetooth Settings|More Bluetooth Options-->comm ports tab: ADD, Incoming connection Take note of virtual comm port number. Now edit BlueClip.ini and set the hostname, port and other options as desired. (N.B. ports entry can be multiline but typically the listener will only have one line.)

	e.g	[DEFAULT]
		hostname = Machine1    	←the name of this machine
		autopaste = 1
		[PORTS]
		ports=
			com3 “LISTENING”	←the port this machine is listening on

On Machine #2: [This machine becomes the Caller that calls the Listener]

Bluetooth Settings|More Bluetooth Options-->comm ports tab: ADD, Outgoing connection, Browse to target = Machine #1 Port <number from above> ←the target machine & it’s port Take note of new virtual comm port number just created (this might be different to Machine#1’s port). Now edit BlueClip.ini and set the hostname, port and other options as desired. (Note the ports entry can be multiline as this machine can call multiple Listeners. Each line has the outgoing port just created on this machine but the name is the name of the target machine it connects to).

	e.g. 	[DEFAULT]
		hostname = Machine2		←the name of this machine
		autopaste = 1			←auto sync whenever clipboard changes
		autominimise=1			←auto minimise BlueClip once connected
		[PORTS]
		ports=
			com6 “Machine1”	←list of this machine’s ports and names
			com7 “Machine3”  	 of the targets they connect to 

Linux

To Be Done...

Usage

  • Launch BlueClip.exe and it will keep trying to connect to the other machine. Once blueclip is launched on the other machine they will automatically connect.
  • If multiple machines are configured then clicking on change connection will try and connect ot the next target. It will remember this new target and try and reconnect next time it’s launched.
  • If the connection is interupted blueClip will keep trying to reconnect.
  • Once connected if autominimise is enabled in the .INI file the app will minimise.
  • If autopaste is enabled then every time the clipboard changes it will be synchronised to the other machine. N.B. If for some reason the synchronisation doesn’t complete then repeating the same Copy again and again will not succeed. You will need to Copy something different to trigger another sync, and then go back and try and Copy the thing you originally wanted.
  • If autopaste is disabled synchronisation only occurs when you click “Paste Now” (=paste to the other machine’s clipboard).

Developer

Setup

pip install pyserial
pip install pyperclip
pip install tkinter
pip install pyinstaller --->(for compilation to .exe)

Compile for windows

cd \<source directory\>

pyinstaller --onefile \<source filename\>    --->.exe produced from filename *.py will run with console active. Filename *.pyw produces .exe with no console output. make sure you're in the source directory!

pyinstaller --onefile -i blueclip.ico "blueclip.pyw"   --->blueclip.exe normal operation

copy blueclip.pyw blueclip.py
pyinstaller --onefile -i blueclip.ico "blueclip debug.py"    --->blueclip debug.exe runs with additional console

pyserial runtime exceptions

N.B. SerialError subclassed from IOError. All info returned as a string 
	e.g. "could not open port COM5: OSError(22,element not found, none, 22)"
    errornum and winerror are empty so must parse these from the string
        
During Open: 
2,2        =wrong port, BT disabled/fault       		caller or listener
22,1168    =remote BT stack error/fault???     		 	caller only
22,121     =remote BT disconnected, connection still being setup      caller only
22,1256    =BT connected remote app not connecting        	caller only
During connection:
22.1617    =local device removed/local BT disabled         	listener (later --> 2.2)
sendfail, not ready =remote app not running, remote app not connecting, remote BT not enabled   (listener)

About

Python program to sync clipboards over Bluetooth serial ports. Large-button UI for accessibility.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%