| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| .config | 1 items | ||
| .github | 2 items | ||
| __pycache__ | 1 items | ||
| bin | 1 items | ||
| cmd | 2 items | ||
| control | 20 items | ||
| internal | 78 items | ||
| scripts | 6 items | ||
| web | 4 items | ||
| web-react | 9,958 items | ||
| .DS_Store | 6.15 kB xet | c585cd02 | |
| .air.toml | 3.03 kB xet | 4971bcd0 | |
| .dockerignore | 747 Bytes xet | 9703f66d | |
| .gitignore | 1.53 kB xet | 32881542 | |
| .goreleaser.yml | 8.06 kB xet | 890cc931 | |
| CommunicationProtocol.md | 11 kB xet | 33fcfa32 | |
| Dockerfile.build | 543 Bytes xet | fc87b31d | |
| LICENSE | 1.11 kB xet | 5be5fdef | |
| Makefile | 11.8 kB xet | 82c0ced6 | |
| README.md | 21.9 kB xet | d5aad9a5 | |
| Structure.md | 2.92 kB xet | 9c8b9907 | |
| airmouse-mcp-go | 11 MB xet | 637832e1 | |
| airmouse-server | 11 MB xet | 7153d5bd | |
| airmouse-server.rb | 824 Bytes xet | 43cb639b | |
| docker-compose.yml | 4.87 kB xet | 3d7477b0 | |
| dockerfile | 1.71 kB xet | f74b4e45 | |
| go.mod | 2.11 kB xet | d7c81fd7 | |
| go.sum | 8.9 kB xet | bdd72b81 | |
| test.go | 247 Bytes xet | 5ced28fd | |
| test_connection.sh | 801 Bytes xet | b2540949 | |
| test_protocols.py | 2.88 kB xet | f89c2e67 | |
| test_results.txt | 3.8 kB xet | 93e0fbc7 |
Air Mouse Pro Server
Crossβplatform, AIβpowered remote control server for the Air Mouse Android app.
Turn your phone into a wireless mouse with advanced features.
π Table of Contents
- Overview
- Features
- Architecture
- Quick Start
- Protocol Specification
- Configuration
- Android App
- Development
- API Reference
- Troubleshooting
- Contributing
- License
π― Overview
Air Mouse Pro Server is the desktop counterpart of the Air Mouse Android app. It receives movement, click, and gesture commands from one or more mobile devices over WebSocket (primary), TCP (fallback), UDP (discovery), Bluetooth (HID), or USB (serial/gadget) and translates them into native mouse and keyboard actions on the host computer.
The server is built with Clean Architecture, making it modular, testable, and easy to extend. It includes a modern Fyneβbased GUI, a responsive web dashboard, and a system tray application for quick access.
Key capabilities include:
- Multiβprotocol β WebSocket (primary), TCP, UDP discovery, Bluetooth HID, USB serial/gadget.
- Low latency β Predictive Kalman filtering, AI smoothing, and jitter buffer hide network lag.
- AI gestures β Recognise custom gestures (swipes, circles, thumbsβup) with onβdevice TensorFlow Lite or serverβside ONNX models.
- Proximity lock/unlock β Uses Bluetooth RSSI to lock the screen when you walk away.
- Client registry β Track connected devices, their names, capabilities, and statistics.
- Modern UI β Fyneβbased dashboard with realβtime stats, device list, QR pairing, and log viewer, plus a web interface.
β¨ Features
π‘ Connectivity
| Protocol | Port | Use |
|---|---|---|
| WebSocket | 8081 | Primary, lowβoverhead, realβtime |
| TCP | 8080 | Plain TCP (fallback) |
| UDP discovery | 8082 | Autoβdetect server on LAN |
| Bluetooth HID | β | Emulate a Bluetooth mouse (Linux/macOS/Windows) |
| USB serial | β | Wired connection via USBβCDC |
π§ AI & Prediction
- Kalman filter β Movement prediction to reduce perceived lag.
- ONNX runtime integration for AIβbased trajectory smoothing (LSTM model).
- Gesture recognition β Classify preβrecorded or custom gestures (DTW + particle filter).
- Online personalisation β Collect user movement and fineβtune models via external Python service.
π ProximityβAware Security
- RSSIβbased distance estimation β Approximate distance from phone to PC.
- Auto lock β Lock screen when phone moves beyond a threshold (e.g., 3β―m).
- Auto unlock β Optional (requires OS support).
- Bluetooth MAC whitelist β Restrict to authorised devices.
π Management & Monitoring
- Client dashboard β List all connected devices with uptime, idle time, bytes transferred.
- Statistics β Total clicks, double clicks, scrolls, movement distance.
- Health metrics β Perβclient ping latency, jitter, message counts.
- Structured logging β JSON logs, levels (debug/info/warn/error), hookable.
π¨ User Interface
- Desktop GUI (Fyne) β Tabs: Dashboard, Devices, Network, Gestures, Proximity, Analytics, Settings, Logs.
- Web Dashboard β Realβtime charts, device management, settings, logs.
- System Tray β Quick start/stop, QR code, status indicators.
- QR code generation β Oneβclick pairing for the Android app.
- Theme support β 8+ builtβin themes (dark, light, pure black, high contrast, ocean, sunset, forest, purple).
ποΈ Architecture
The project follows Clean Architecture (Onion) with four concentric layers:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Delivery Layer β
β (WebSocket/HTTP handlers, DTOs) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Use Case Layer β
β (mouse, gesture, connection services) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Repository Layer β
β (client, gesture, mouse repositories) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β Infrastructure Layer β
β (mouse control, Bluetooth, USB, logging) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
- Domain (
internal/domain) β pure business logic, no external dependencies. - Repository (
internal/repository) β concrete implementations of repository interfaces. - Handler (
internal/handler) β WebSocket and HTTP endpoints, DTOs, message routing. - Infra (
internal/infra) β platformβspecific mouse control, Bluetooth, USB, logging.
All dependencies point inward. The cmd/airmouse-server/main.go wires everything together using constructor injection.
π Quick Start
Prerequisites
- Go 1.23+ (if building from source)
- For AI smoothing: ONNX Runtime shared library (optional, autoβfetched by go module)
- For Linux mouse input:
/dev/uinputwritable (or installxdotool) - For Bluetooth: BlueZ (Linux), CoreBluetooth (macOS), Windows Bluetooth stack
- For building the GUI:
gcc(required by Fyne)
Installation
macOS (Homebrew)
brew tap yourusername/airmouse
brew install airmouse-server
Linux (APT)
sudo apt update
sudo apt install ./airmouse-server.deb
Windows (Scoop)
scoop bucket add airmouse https://github.com/yourusername/airmouse-scoop
scoop install airmouse-server
Docker
# Pull and run
docker run -d --name airmouse-server \
-p 8080:8080 -p 8081:8081 -p 8082:8082/udp \
-v airmouse-data:/var/lib/airmouse \
-v airmouse-logs:/var/log/airmouse \
airmouse/airmouse-server:latest
# Or use docker-compose
docker-compose up -d
From Source
git clone https://github.com/yourusername/airmouse-go.git
cd airmouse-go
make deps
make build
./airmouse-server
First Run
- Start the server β click βStart Serverβ in the Dashboard tab or use the system tray.
- Connect the Android app β scan the QR code from the Network tab or the system tray menu.
- Control β move your phone; the cursor follows.
- Explore β check connected devices in the Devices tab, view statistics, configure gestures, and set up proximity lock.
π‘ Protocol Specification
Transport
- Primary: WebSocket over TCP (port 8081).
- Alternative: Raw TCP (port 8080) β for simple clients.
- Discovery: UDP broadcast on port 8082.
- Message format: JSONβline, each message terminated by
\n.
Client β Server Messages
| Type | Payload Example | Description |
|---|---|---|
move |
{"dx": 1.5, "dy": 2.0} |
Relative cursor movement |
click |
{"button": "left"} |
Left, right, or middle click |
doubleclick |
{} |
Double left click |
rightclick |
{} |
Right click |
scroll |
{"delta": 1} |
Scroll up (positive) or down (negative) |
hello |
{"name": "MyPhone", "version": "3.0"} |
Identify device (name appears in dashboard) |
ping |
{} |
Keepβalive (server responds with pong) |
gesture |
{"gesture": "ThumbsUp", "confidence": 0.92} |
Recognised gesture (sent by Android app) |
proximity |
{"device_id": "abc123", "is_near": true, "distance": 1.23} |
Distance update (for auto lock/unlock) |
control |
{"command": "pause_movement"} |
Temporarily stop/resume mouse movement |
Server β Client Messages
| Type | Payload | Description |
|---|---|---|
welcome |
{"server":"AirMouse","version":"3.0","id":"..."} |
Sent after hello |
ping |
{} |
Heartbeat request |
pong |
{} |
Heartbeat response |
ack |
{"id": "..."} |
Acknowledgement of a command (optional) |
Proximity (Optional Extension)
When the Android appβs proximity service is active, it sends:
{
"type": "proximity",
"payload": {
"is_near": true,
"distance": 1.23
}
}
The server evaluates thresholds and locks/unlocks the screen accordingly.
βοΈ Configuration
The server reads ~/.config/airmouse/config.json (Linux/macOS) or %APPDATA%\airmouse\config.json (Windows).
Example:
{
"server": {
"host": "0.0.0.0",
"port": 8080,
"websocket_port": 8081,
"udp_port": 8082,
"enable_tcp": true,
"enable_websocket": true,
"enable_udp": true,
"enable_bluetooth": true,
"enable_serial": false,
"server_name": "Air Mouse Pro",
"user_name": "User",
"version": "3.0.0",
"language": "en",
"auto_start_server": false
},
"mouse": {
"sensitivity": 1.0,
"smoothing_enabled": true,
"acceleration_enabled": true,
"click_threshold": 5.0,
"scroll_threshold": 3.0,
"double_click_interval": 300,
"right_click_tilt": 45.0,
"haptic_enabled": true
},
"ai": {
"enable_ai_smoothing": false,
"ai_model_path": "models/mouse_smoothing.onnx",
"ai_blend_factor": 0.6,
"enable_predictive": true,
"predictive_blend_factor": 0.6,
"enable_jitter_compensation": true,
"jitter_max_latency_ms": 100
},
"gesture": {
"gesture_confidence_threshold": 0.7,
"gesture_cooldown_ms": 500
},
"proximity": {
"proximity_enabled": false,
"proximity_near_threshold": 1.0,
"proximity_far_threshold": 3.0
},
"bluetooth": {
"bluetooth_adapter": "default",
"ble_enabled": true,
"hid_proxy_enabled": false
},
"usb_gadget": {
"usb_gadget_enabled": false,
"usb_vendor_id": "0x1d6b",
"usb_product_id": "0x0104"
},
"logging": {
"log_level": "info",
"log_file": "",
"log_color": true
},
"ui": {
"theme": "dark",
"accent_color": "#6366f1",
"always_on_top": false,
"show_tray_icon": true,
"window_width": 1400,
"window_height": 900
}
}
All settings can also be changed via the Settings tab in the GUI or the web interface.
The server applies changes immediately and saves them to disk.
π± Android App
The Android app is written in Kotlin with Coroutines, OkHttp for WebSocket, and TensorFlow Lite for gesture classification. It uses the deviceβs sensors (gyroscope, accelerometer) to generate movements and recognises gestures using a custom TFLite model.
Download
Features
- π± Cursor control β Move your phone to control the mouse cursor.
- π±οΈ Click & scroll β Tap for left click, twoβfinger tap for right click, swipe for scroll.
- β Gesture recognition β Thumbs up/down, swipes, circles, pinch.
- π‘ Proximity lock β Autoβlock/unlock based on Bluetooth distance.
- π QR pairing β Secure oneβtime token exchange.
- π Connection stats β Latency, jitter, battery status.
π οΈ Development
Project Structure
airmouse-go/
βββ cmd/airmouse-server/ # Entry point
β βββ main.go # Main application
β βββ icons.go # Embedded icons
βββ internal/
β βββ domain/ # Entities, repositories, services
β β βββ entity/ # Domain models
β β βββ repository/ # Repository interfaces
β β βββ service/ # Business logic services
β βββ infra/ # Infrastructure
β β βββ logger/ # Logging
β β βββ mouse/ # Platform mouse control
β βββ handler/ # Delivery layer
β β βββ websocket/ # WebSocket hub, handler, client
β β βββ http/ # HTTP router, middleware, static
β β βββ dto/ # Data transfer objects
β βββ ui/ # Fyne GUI
β β βββ app.go # Main window
β β βββ dashboard.go # Dashboard tab
β β βββ devices.go # Devices tab
β β βββ network.go # Network tab
β β βββ gestures.go # Gestures tab
β β βββ proximity.go # Proximity tab
β β βββ analytics.go # Analytics tab
β β βββ settings.go # Settings tab
β β βββ logs.go # Logs tab
β β βββ themes.go # Theme management
β β βββ tray.go # System tray
β β βββ about.go # About dialog
β β βββ helpers.go # Helper functions
β β βββ icons.go # Icon resources
β β βββ pairing.go # Pairing wizard
β β βββ charts.go # Chart components
β β βββ connection.go # Connection quality widget
β β βββ shortcuts.go # Keyboard shortcuts
β βββ protocol/ # Protocol implementations
β β βββ tcp/ # TCP server
β β βββ udp/ # UDP discovery
β β βββ websocket/ # WebSocket server
β β βββ bluetooth/ # BLE manager, HID, serial
β β βββ usb/ # USB serial, gadget
β βββ control/ # Mouse control, AI, ML
β β βββ mouse.go # Mouse controller
β β βββ predictor.go # Movement predictor
β β βββ ai_smoother.go # ONNX AI smoother
β β βββ ml_predictor.go # LSTM predictor
β β βββ gesture.go # Gesture detection
β β βββ pause.go # Movement pause
β βββ auth/ # Authentication manager
β βββ config/ # Configuration management
β βββ device/ # Device manager
β βββ proximity/ # Proximity manager
β βββ sysaction/ # System actions (lock, media keys)
β βββ sensorfusion/ # Madgwick, Mahony filters
β βββ jitter/ # Jitter buffer, Kalman
β βββ particlefilter/ # Particle filter gesture recognition
β βββ predictiveml/ # ML predictor, trainer
β βββ personalization/ # Data collector, trainer client
β βββ adaptivesmoothing/ # Humanizer, Bβspline, tremor
β βββ utils/ # Utilities (crypto, net, random)
βββ web/ # Web interface assets
β βββ static/
β βββ index.html # Web dashboard
β βββ style.css # Styles
β βββ app.js # JavaScript
βββ scripts/ # Installation scripts
βββ config.example.json # Example configuration
βββ docker-compose.yml # Docker Compose setup
βββ Dockerfile # Container definition
βββ Makefile # Build automation
βββ go.mod # Go module
βββ go.sum # Dependency checksums
βββ README.md # This file
βββ LICENSE # MIT License
Build Commands
make build # Build for current platform
make build-windows # Build for Windows
make build-linux # Build for Linux
make build-mac # Build for macOS Intel
make build-mac-arm # Build for macOS Apple Silicon
make build-all # Build all platforms
make run # Run the application
make run-debug # Run with debug logging
make clean # Clean build artifacts
Testing
make test # Run all tests
make test-coverage # Run tests with coverage report
make bench # Run benchmarks
Code Quality
make lint # Run golangci-lint
make fmt # Format code
Docker
make docker-build # Build Docker image
make docker-run # Run Docker container
docker-compose up -d # Run full stack (server + redis + postgres + trainer + monitoring)
π API Reference
REST Endpoints (HTTP)
| Endpoint | Method | Description |
|---|---|---|
/health |
GET | Health check |
/api/status |
GET | Server status (running, uptime, clients) |
/api/stats |
GET | Statistics (clicks, scrolls, movements) |
/api/devices |
GET | List connected devices |
/api/qrcode |
GET | Generate pairing QR code |
/api/config |
GET/POST | Get/update configuration |
/api/gestures |
GET/POST | List/add gestures |
/api/proximity |
GET/POST | Get/update proximity settings |
/api/logs |
GET | Get system logs |
/api/start |
POST | Start server |
/api/stop |
POST | Stop server |
/api/stats/reset |
POST | Reset statistics |
WebSocket Endpoint
- URL:
ws://<server-ip>:8081/ws - Query params:
?token=<auth_token>(if authentication enabled)
π Troubleshooting
Server wonβt start
- Check that the port is not already in use (
lsof -i :8080). - Ensure you have write permission to the config directory.
WebSocket connection refused
- Verify firewall allows incoming connections on port 8081.
- On Linux, check that
ufworiptablesis not blocking.
Mouse movement is jerky
- Increase
predictive_blend_factor(0.7 β 0.9). - Enable AI smoothing if you have a good ONNX model.
- Reduce network latency (use Ethernet or 5 GHz WiβFi).
Gesture not recognised
- Record more training samples (5β10 repetitions).
- Lower
gesture_confidence_threshold(e.g., 0.6). - Check that the gesture template is properly formatted.
Proximity lock doesnβt work
- Ensure Bluetooth is enabled and the phone is paired.
- Adjust
near_thresholdandfar_thresholdin config. - On Linux, verify that
loginctl lock-sessionworks from terminal.
AI smoother not loading
- The model file must be placed at
models/mouse_smoothing.onnx. - Build with
-tags aito include real ONNX support. - Check that ONNX Runtime shared library is installed (
libonnxruntime.soon Linux).
USB gadget not working (Linux)
- Ensure configfs is mounted:
mount | grep configfs - Load the libcomposite kernel module:
modprobe libcomposite - Run the server as root or with appropriate permissions.
π€ Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a feature branch (
git checkout -b feature/amazing-feature). - Commit your changes (
git commit -m 'Add amazing feature'). - Push to the branch (
git push origin feature/amazing-feature). - Open a Pull Request.
Please ensure your code follows the existing style and passes all tests.
Development Guidelines
- Use
gofmtfor formatting. - Add tests for new features.
- Update documentation when changing behaviour.
- Follow Clean Architecture principles.
π License
MIT License β Copyright (c) 2025 University of Tehran, Embedded Systems Laboratory.
See LICENSE for full text.
π Acknowledgements
- Fyne β Cross-platform GUI toolkit
- Gorilla WebSocket β WebSocket implementation
- ONNX Runtime β AI model inference
- GoQR β QR code generation
- systray β System tray support
π§ Contact
- Issues: GitHub Issues
- Discord: Air Mouse Community
- Email: support@airmouse.io
Built with Go, Fyne, and ONNX Runtime β ready for production.
- Total size
- 5.54 GB
- Files
- 51,854
- Last updated
- Sep 12
- Pre-warmed CDN
- US EU US EU