Cursorly is an open-source, end-to-end Mobile-to-PC Touchpad and Mouse Control System. Built with a Python + FastAPI + Win32 SendInput host engine and a Kotlin + Jetpack Compose Android client (plus a zero-install browser trackpad and direct ADB Linux kernel streamer), Cursorly turns any Android phone or tablet into a low-latency, jitter-free, multi-touch wireless or wired trackpad.
Windows Host & Standalone Bluetooth HID Note: The PC host service targets Windows 10 / 11 via native Win32
SendInputand multimedia timers (when targeting an elevated/Administrator window, run the host terminal as Administrator so Windows UIPI permits input injection). For host-free usage across Windows, macOS, or Linux, the Android app also includes a Standalone Bluetooth HID Mouse mode.
[ TOUCH STREAM ] ──► [ TRANSPORT ] ──► [ GESTURE ENGINE ] ──► [ 1€ FILTER & BALLISTICS ] ──► [ SUB-PIXEL ACCUMULATOR ] ──► [ WIN32 / BT HID ]
Check out a simulation of Cursorly for visual understanding
- Multi-Transport Connectivity: Connects seamlessly over USB Tethering (RNDIS), Wi-Fi / Mobile Hotspot (WebSockets +
TCP_NODELAY), Bluetooth RFCOMM Host, Standalone Bluetooth HID Mouse, Zero-Install HTML5 Browser Trackpad, or Direct ADB Kernel Streaming (/dev/input/event*). - One Euro (1€) Adaptive Jitter Filtering & Error Diffusion: Suppresses capacitive sensor jitter down to
0.8 Hzduring micro-aiming while opening up to120 Hz+for lag-free flicks, paired with a fractionalSubpixelAccumulatorthat preserves remainders across integerSendInputticks. - Double-Tap-to-Drag & Multi-Touch Gestures: Implements a
200 msdeferred single-tap +8 dpdrag-start disambiguation state machine so double-tap cleanly maximizes windows while double-tap-and-move drags smoothly, alongside 2-finger smooth scroll, pinch-to-zoom, 2-finger right click, 3-finger middle click, virtual desktop switching (Win+Ctrl+Left/Right), and Task View (Win+Tab). - Split-Touch Mouse Buttons & Remote Keyboard: Independent multi-touch Left Click, Mid, and Right Click buttons below the trackpad surface let you hold any mouse button while moving, tapping, or scrolling, paired with a collapsible remote Unicode keyboard and shortcut bar.
- Zero-Config Multi-Interface Auto-Discovery: Combines UDP broadcast beacons (
41234), mDNS/NSD (_cursorly._tcp.), and Windows Bluetooth radio lookup (bthprops.cpl) so the Android app automatically discovers PCs across Wi-Fi, Hotspot, USB Tethering, and Bluetooth. - Dual Orientation & Precision Sniper Mode: Supports Portrait and 90°-rotated Landscape tracking plus an instant Sniper Mode (
0.35xsensitivity dampener) controllable from either the phone UI or live PC console hotkeys.
Cursorly/
├── android/ # Native Android Jetpack Compose client (Android Studio project)
│ ├── app/
│ │ ├── src/
│ │ │ ├── main/
│ │ │ │ ├── java/com/cursorly/trackpad/
│ │ │ │ │ ├── discovery/ # UDP, mDNS/NSD, USB & Bluetooth discovery
│ │ │ │ │ ├── input/ # Unbuffered TouchSurfaceView & LocalHidGestureEngine
│ │ │ │ │ ├── model/ # Transport, host & trackpad settings models
│ │ │ │ │ ├── protocol/ # 18-byte binary packet & RFCOMM framing codec
│ │ │ │ │ ├── transport/ # WebSocket, Bluetooth RFCOMM & BT HID transports
│ │ │ │ │ ├── ui/ # TrackpadScreen, ConnectionSheet, SettingsSheet, KeyboardBar
│ │ │ │ │ └── MainActivity.kt # Compose entry point & permissions
│ │ │ │ ├── res/ # App icons, strings & dark theme
│ │ │ │ └── AndroidManifest.xml # Network, multicast & Bluetooth permissions
│ │ │ └── test/java/com/cursorly/trackpad/ # JUnit tests (OneEuroFilter2DTest, PacketCodecTest)
│ │ └── build.gradle.kts # Android app dependencies & SDK configuration
│ ├── gradle/wrapper/ # Gradle Wrapper configuration & JAR
│ ├── build.gradle.kts # Root Gradle plugin declarations
│ ├── gradle.properties # JVM & AndroidX flags
│ ├── gradlew # Gradle Wrapper script (macOS / Linux / CI)
│ ├── gradlew.bat # Gradle Wrapper script (Windows)
│ └── settings.gradle.kts # Gradle module configuration
├── cursorly/ # Python PC host package
│ ├── adapters/
│ │ ├── adb_streamer.py # Direct Linux kernel /dev/input/event* ADB streamer
│ │ ├── bluetooth_server.py # Windows AF_BLUETOOTH RFCOMM/SPP server
│ │ ├── discovery.py # UDP multi-interface beacon & BT MAC lookup
│ │ └── web_server.py # FastAPI WebSocket + zero-install HTML5 trackpad
│ ├── engine/
│ │ ├── ballistics.py # Dynamic velocity acceleration & Sniper dampener
│ │ ├── filter_one_euro.py # 1€ adaptive noise filter (1D & 2D)
│ │ ├── gestures.py # Multi-touch gestures & double-tap-drag state machine
│ │ └── subpixel_accumulator.py # Fractional remainder sub-pixel accumulator
│ ├── injection/
│ │ └── win32_mouse.py # Win32 SendInput mouse/keyboard & 1ms timer
│ └── main.py # CLI entry point, pending scheduler & telemetry
├── tests/ # Python unit test suite (33 tests)
│ ├── test_ballistics.py # Sensitivity clamping, Sniper & ballistics tests
│ ├── test_discovery_and_transports.py # Interface classification, RFCOMM, API & ADB tests
│ ├── test_gestures.py # Tap, double-tap-drag, scroll & filter integration tests
│ ├── test_one_euro_filter.py # Jitter suppression & high-speed tracking tests
│ ├── test_orientation.py # Portrait/Landscape rotation math tests
│ └── test_subpixel_accumulator.py # Sub-pixel error-diffusion conservation tests
├── .github/ # CI workflow, PR template & issue templates
├── pyproject.toml # Package metadata, console script & setuptools config
├── requirements.txt # Runtime dependencies (fastapi, uvicorn)
├── requirements-dev.txt # Development dependencies (pytest, ruff)
├── setup.bat # One-click Windows venv & dependency setup
└── run_cursorly.bat # Windows virtual-environment launcher
| Transport Mode | PC Host Required | Auto-Discovery | Typical Rate / Latency | Best Use Case |
|---|---|---|---|---|
| USB Tethering (RNDIS) | Yes | Yes (UDP 41234) |
120–360 Hz · ~1–8 ms |
Lowest-jitter wired connection without ADB |
| Wi-Fi / Mobile Hotspot | Yes | Yes (UDP + mDNS) | 120–360 Hz · ~5–15 ms |
Everyday wireless control on local LAN or phone hotspot |
| Bluetooth Host (RFCOMM) | Yes | Yes (Paired BT + UDP) | 120 Hz+ · Wireless |
Wireless control without Wi-Fi or shared LAN |
| Bluetooth HID Mouse | No | Paired BT Device | Native HID Mouse | Controlling Windows, macOS, or Linux with zero host software |
| Direct ADB Kernel Stream | Yes | USB / Wireless ADB | 120–360 Hz+ · ~1–3 ms |
Zero-app Linux /dev/input/event* digitizer capture |
| Web Browser Trackpad | Yes | Manual URL (:8080) |
Coalesced Pointer Events | Zero-install control from any mobile browser |
- Windows 10 or Windows 11 (for the PC host using Win32
SendInput) - Python
>= 3.10(withvenvandpip) - Android Device (
Android 9 / API 28+) - Optional (for building from source or ADB mode): Android Studio (with Android SDK Platform
37.0, Build-Tools37.0.0, and Platform-Tools installed via SDK Manager); ensure Android SDKplatform-tools(adb) is on yourPATHif using--mode adb
- Install the Android App: Download the latest APK from GitHubReleases and install it on your Android phone.
- Setup the PC Host: Double-click
setup.baton Windows (creates.venvand installs dependencies fromrequirements.txt). - Launch the PC Host: Double-click
run_cursorly.batto start Cursorly in default Seamless mode (Wi-Fi / Hotspot / USB Tethering + Bluetooth RFCOMM + Auto-Discovery). If Windows Firewall prompts, allow access on Private networks. - Connect: Open Cursorly on your phone—your PC appears automatically in Available PCs (or auto-connects when a single host is detected).
Download the latest APK from GitHubReleases and install it on your Android phone.
git clone https://github.com/mhsatgit/Cursorly.git
cd Cursorly
py -3 -m venv .venv
.\.venv\Scripts\activate
pip install -r requirements.txt# Default Seamless mode (WebSocket + UDP Auto-Discovery + Bluetooth RFCOMM)
python -m cursorly.main
# Start directly in Landscape mode or Sniper Precision mode
python -m cursorly.main --landscape
python -m cursorly.main --precision
# Custom base sensitivity (0.25x) or 1:1 raw linear tracking
python -m cursorly.main --sens 0.25
python -m cursorly.main --linear --sens 0.4
# Target a specific transport mode
python -m cursorly.main --mode web --port 8080
python -m cursorly.main --mode bluetooth
python -m cursorly.main --mode adb --serial 192.168.1.50:5555- Open
android/in Android Studio and build/install the APK (see Run Android Unit Tests & Build Debug APK). - Or install the generated APK onto your phone (
adb install -r android\app\build\outputs\apk\debug\app-debug.apk). - Launch Cursorly on Android while the PC host is running—your PC appears automatically in Available PCs (or auto-connects when a single host is detected).
- Browser Fallback: Without installing the APK, open
http://<PC_IP>:8080in Chrome or Firefox on your phone.
# Activate .venv or run directly via .venv\Scripts\python.exe
python -m unittest discover tests -v
# Optional: with pytest and ruff (install requirements-dev.txt first)
pip install -r requirements-dev.txt
pytest -v
ruff check cursorly testsCursorly uses a standard Android Studio project under android/ with the included Gradle Wrapper (gradlew / gradlew.bat)—no repository-local SDK, JDK, or Gradle installation is required.
- Install Android Studio and open the
android/directory (File > Open... -> selectandroid/). - Open Settings / SDK Manager > Languages & Frameworks > Android SDK and install:
- SDK Platforms: Android API 37 (
android-37.0, matchingcompileSdk 37) - SDK Tools: Android SDK Build-Tools 37.0.0 and Android SDK Platform-Tools (includes
adb)
- SDK Platforms: Android API 37 (
- Open Settings > Build, Execution, Deployment > Build Tools > Gradle and set Gradle JDK to Android Studio's bundled JetBrains Runtime (JDK 25 /
jbr, or any compatible JDK 17+). - Wait for Gradle Sync to finish—Android Studio automatically generates
android/local.propertiespointing to your local Android SDK and fetches dependencies via the Gradle Wrapper (Gradle 9.9.1).
- Run Unit Tests: Right-click
android/app/src/testin the Project view and click Run 'All Tests'. - Build Debug APK: Choose Build > Build App Bundle(s) / APK(s) > Build APK(s) (outputs to
android/app/build/outputs/apk/debug/app-debug.apk). - Run on Device: Connect an Android device with USB Debugging enabled and click Run (
Shift+F10).
From Android Studio's Terminal (or PowerShell with JAVA_HOME set to Android Studio's jbr / JDK and ANDROID_HOME or android/local.properties configured):
cd android
# Run Android unit tests and build the debug APK
.\gradlew.bat testDebugUnitTest assembleDebug
# (Optional) Install and launch the built APK on a connected USB-debugging device
adb install -r app\build\outputs\apk\debug\app-debug.apk
adb shell am start -n com.cursorly.trackpad/.MainActivity| Protocol / Method | Endpoint / Port | Description |
|---|---|---|
UDP |
0.0.0.0:41234 |
Multi-interface auto-discovery (CURSORLY_DISCOVER_V1 / beacons) |
GET |
/ |
Serves the zero-install HTML5 mobile web trackpad client |
GET |
/api/info |
Returns host name, ws_port, connected_clients, and live state |
WS |
/ws |
Streams 18-byte big-endian binary touch frames (!BBffd) & JSON control actions |
RFCOMM |
SPP UUID 7a9d3c10-8f4b-4e2a-9c1d-5b6e7f8a9012 |
Length-prefixed binary touch & JSON control frames over Bluetooth |
| Input | Action |
|---|---|
| 1 Finger Move / Tap / Double-Tap & Drag | Cursor movement, Left Click, Double-Click, and Click-and-Drag |
| 2 Fingers Move / Pinch / Tap | Smooth 2D Scroll, Pinch-to-Zoom (Ctrl+Wheel), and Right Click |
| 3 Fingers Tap / Swipe Horizontal / Swipe Up | Middle Click, Switch Virtual Desktop (Win+Ctrl+Left/Right), Task View (Win+Tab) |
PC Console [O]/[L] · [P] · [-]/[+] · [1–4] |
Toggle Portrait/Landscape, toggle Sniper Mode, step sensitivity, or apply presets (0.20x–1.00x) |
Cursorly injects OS-level mouse and keyboard input via Windows SendInput and opens local-network UDP/HTTP/WebSocket listeners on trusted LAN, hotspot, or USB tethering interfaces. Use it only on trusted networks and devices you own or administer.
This project is open source and available under the MIT License. See LICENSE for details.