ζ₯ζ¬θͺη README γ―γγ‘γ | Japanese README here
A Bluetooth Low Energy (BLE) connected app that allows you to use your iPhone/Android as a macOS touchpad.
RemoteTouch is an app that enables you to use your smartphone as a wireless touchpad for Mac. Through Bluetooth connection, it realizes cursor operations, clicks, and browser navigation (back/forward).
βββββββββββββββββββ BLE βββββββββββββββββββ
β iOS / Android β βββββββββββββββββββββΊ β macOS β
β (Remote Side) β BLE Peripheral β (Receiver) β
β Touchpad Ops β Advertise & Send β BLE Central β
β β Commands β Scan & Connect β
βββββββββββββββββββ βββββββββββββββββββ
Architecture Features:
- iOS/Android app advertises as BLE Peripheral
- macOS app scans and connects as BLE Central
- iOS/Android sends commands (touchpad operations, button clicks, etc.) in JSON format
- macOS receives commands and generates system events via CGEvent API
- Swipe: Cursor movement (supports vertical and horizontal directions)
- Single Tap: Left click (cursor position unchanged)
- Double Tap: Double click (cursor position unchanged)
- Visual Feedback on Touch: Blue border lights up on touch
- Sensitivity Adjustment: Adjustable from 0.5x to 3.0x
Three switchable modes:
-
Basic Mouse Mode
- Standard mouse operations
- Back/Forward buttons
-
Presentation Mode
- Optimized for presentation operations
- Previous/Next slide buttons
-
Media Control Mode
- Media playback operations
- Play/Pause, Volume buttons
- Basic Mouse Mode: Back (β) / Forward (βΆ)
- Presentation Mode: Previous (β) / Next (βΆ)
- Media Control Mode: Play/Pause (βΆ) / Volume (π)
- Ripple Effect: Visual feedback on button tap
- Control Mode: Navigate to mode selection screen
- Touchpad Sensitivity: Adjust sensitivity with slider (0.5x - 3.0x)
- About: Display app information
- Settings Persistence: Auto-save and restore settings with SharedPreferences
- Auto-Advertise: Automatically start BLE advertising when Android app launches
- Auto-Connect: macOS automatically detects and connects to nearby devices
- Connection Status Display: Real-time connection status (Bluetooth icon)
- macOS: macOS 10.15 (Catalina) or later
- iOS: iOS 15.0 or later (not yet implemented)
- Android: Android 12.0 (API 31) or later, BLE Peripheral-compatible device
- Flutter: 3.0 or later
- Bluetooth: Both devices must support Bluetooth 4.0 (BLE) or later
git clone https://github.com/Kazuki-0731/remote-touch.git
cd remote-touchflutter pub get
cd macos && pod install && cd ..Method 1: Using Makefile (Recommended)
make install-macosThis command will:
- Create a release build
- Install to /Applications/remote_touch.app
- Make it launchable from Spotlight
Method 2: Manual Build
flutter build macos --release
cp -R build/macos/Build/Products/Release/remote_touch.app /Applications/Important: Please grant Accessibility Permission on first launch.
- System Settings > Privacy & Security > Accessibility
- Add remote_touch app to the allowed list
flutter run -d <android-device-id>Check device ID:
flutter devices- Bluetooth is ON on both devices
- Accessibility permission is granted on macOS side
- iOS/Android and macOS are nearby (BLE communication range: about 10m)
open /Applications/remote_touch.appOr search for "remote_touch" from Spotlight
- RemoteTouch icon will appear in the menu bar
- The app automatically starts BLE scanning
- Launch RemoteTouch app on your smartphone
- The app automatically starts BLE advertising
- When the macOS app detects your smartphone, it automatically connects
- When connection succeeds, the touchpad screen will appear
Screen Layout:
βββββββββββββββββββββββββββββββββββ
β RemoteTouch π΅ Connected γβοΈβ
βββββββββββββββββββββββββββββββββββ€
β β
β βββββββββββββββββββββββββββ β
β β β β
β β β β
β β Touchpad β β
β β Area β β
β β β β
β β (Lights up blue on β β
β β touch) β β
β βββββββββββββββββββββββββββ β
β β
β ββββββββββββ ββββββββββββ β
β β β Back β β Forward βΆβ β
β ββββββββββββ ββββββββββββ β
βββββββββββββββββββββββββββββββββββ
Basic Operations:
- Swipe: Swipe on touchpad area to move cursor
- Swipe down β Cursor moves down
- Swipe up β Cursor moves up
- Same for horizontal direction
- Tap: Tap once for left click (cursor doesn't move)
- Double Tap: Tap twice quickly for double click (cursor doesn't move)
Settings Screen:
- Tap the βοΈ icon on the top right of AppBar
- Control Mode: Mode selection (Basic Mouse / Presentation / Media Control)
- Tap to select from three modes
- Selected mode is automatically saved
- Touchpad Sensitivity: Adjust sensitivity (50% - 300%)
- Drag the slider to adjust
- Adjusted sensitivity is automatically saved
- About: App information
- Save Settings: Settings are automatically saved when you go back and restored on next launch
Mode-Specific Buttons:
- Basic Mouse Mode:
- Back (β): Go back in browser/Finder (Command+β)
- Forward (βΆ): Go forward in browser/Finder (Command+β)
- Presentation Mode:
- Previous (β): Previous slide (Command+β)
- Next (βΆ): Next slide (Command+β)
- Media Control Mode:
- Play/Pause (βΆ): Play/Pause
- Volume (π): Volume up
The project includes a Makefile for build automation:
make install-macos # Build and install to /Applications (recommended)
make build-macos # Release build only
make run-macos # Launch installed app
make clean-macos # Clean macOS build
make dev-macos # Run in debug modemake build-ios # iOS release build
make run-ios # Run on device/simulator
make clean-ios # Clean iOS build and Pods
make dev-ios # Run in debug modemake build-android # Build Android APK
make run-android # Run on device
make dev-android # Run in debug modemake deps # Install Flutter dependencies and Pods
make clean # Clean all build caches
make test # Run tests
make release-all # Release build for all platforms
make help # Show all commandsremote-touch/
βββ lib/ # Flutter/Dart code (mobile common)
β βββ main.dart # Main entry point
β βββ services/
β βββ ble_peripheral_manager.dart # BLE Peripheral management
βββ macos/ # macOS-specific code
β βββ Runner/
β βββ Services/
β β βββ BLECentralManager.swift # BLE Central implementation
β β βββ CommandProcessor.swift # Command processing
β β βββ EventGenerator.swift # CGEvent API
β β βββ AccessibilityManager.swift # Permission management
β βββ Models/
β β βββ Command.swift # Command model
β βββ AppDelegate.swift
β βββ ApplicationController.swift # Menu bar management
βββ android/
β βββ app/src/main/kotlin/com/example/remote_touch/
β βββ BLEPeripheralPlugin.kt # Android BLE Peripheral
βββ Makefile # Build automation
βββ README.md # This file
- Framework: Flutter 3.0+
- Language: Dart
- BLE Communication:
- Android: Kotlin (BluetoothGattServer, BluetoothLeAdvertiser)
- iOS: Swift (CoreBluetooth) β»Not yet implemented
- UI: Material Design 3
- Framework: Swift + AppKit
- BLE Communication: CoreBluetooth (CBCentralManager)
- System Events: CGEvent API
- Menu Bar: NSStatusBar
- Android/iOS: SharedPreferences (save and load settings)
- Saved Settings:
- Touchpad sensitivity (0.5 - 3.0)
- Control mode (BasicMouse / Presentation / MediaControl)
Service UUID: 12345678-1234-1234-1234-123456789abc
Command Characteristic: 87654321-4321-4321-4321-cba987654321
Command Format (JSON):
{
"type": "mouseMove",
"dx": -5.2,
"dy": 10.3,
"timestamp": 1763400392894
}Supported Command Types:
mouseMove: Cursor movement (dx, dy parameters, with sensitivity applied)click: Left click (cursor position unchanged)doubleClick: Double click (cursor position unchanged)back: Back operation (Command+β)forward: Forward operation (Command+β)playPause: Play/Pause (Media Control Mode)volumeUp: Volume up (Media Control Mode)
- Android/iOS touch coordinates: Top-left origin, Y-axis increases downward
- macOS Quartz coordinates: Top-left origin, Y-axis increases downward
- Conversion processing: Added as
y + dyin EventGenerator.swift
Android Side:
- BLE callbacks execute on Background thread
- Flutter MethodChannel can only be called from Main thread
- Posted to Main thread with
Handler(Looper.getMainLooper())
macOS Side:
- BLE callbacks execute on Main thread
- CGEvent API can be called from any thread
Implementation:
- Uses
shared_preferencespackage - Settings keys managed as constants in
SettingsKeysclass - Loaded with
_loadSettings()on app launch - Saved with
_saveSettings()when returning from settings screen
Saved Settings:
// Touchpad sensitivity (double: 0.5 - 3.0)
'touchpad_sensitivity': 1.0
// Control mode (int: enum index)
'control_mode': 2 // 0=Presentation, 1=MediaControl, 2=BasicMouseDefault Values:
- Sensitivity: 1.0 (100%)
- Mode: BasicMouse (index: 2)
Q: Cursor doesn't move
- A: Check if Accessibility permission is granted
- System Settings > Privacy & Security > Accessibility
- Verify remote_touch is in the list and checked
Q: Android device is not detected
- A1: Check if Bluetooth is ON on both devices
- A2: Check if devices are nearby (communication range: about 10m)
- A3: Restart macOS app
Q: Vertical axis movement is reversed
- A: Check if coordinate calculation in EventGenerator.swift is correct
- Correct:
y: currentLocation.y + clampedDelta.y - Wrong:
y: currentLocation.y - clampedDelta.y
- Correct:
Q: Cannot connect (BLUETOOTH_ADVERTISE error)
- A: Runtime permission required on Android 12 or later
- Settings > Apps > RemoteTouch > Permissions
- Allow "Nearby devices"
Q: Commands not sent (device must not be null error)
- A: Please update to the latest version
- Fixed in BLEPeripheralPlugin.kt to save
connectedDevice
- Fixed in BLEPeripheralPlugin.kt to save
Q: Touchpad response is poor
- A: Try hot reload (
rkey)
β Touchpad Operations
- Swipe for cursor movement
- Tap for click (no cursor movement)
- Double tap for double click (no cursor movement)
- Visual feedback on touch
β Control Modes
- Basic Mouse Mode
- Presentation Mode
- Media Control Mode
β Settings Features
- Touchpad sensitivity adjustment (0.5x - 3.0x)
- Mode selection screen
- About information
- Settings persistence (SharedPreferences)
β BLE Communication
- Android BLE Peripheral implementation
- macOS BLE Central implementation
- Auto-connect and reconnect
- iOS version: Not yet implemented (only Android version works)
- Multi-display: Only one display supported
- Right click: Not implemented (only left click and double click)
- Scroll: Not implemented (such as two-finger swipe)
- Multiple connections: Only 1-to-1 connection (multiple device simultaneous connection not available)
- Media Control Mode: playPause and volumeUp commands not implemented on macOS side
- iOS version implementation
- macOS media control command support
- Right click feature (such as long press)
- Two-finger scroll
- macOS settings persistence (UserDefaults)
- Connection history saving
- Battery information display
- Multiple device management (save up to 5 Macs)
This project is released under the MIT License.
Pull requests are welcome! We welcome contributions of any kind, including bug reports, feature requests, and code contributions.
- CONTRIBUTING.md - Contribution guidelines
- Branch Strategy - GitHub Flow details
- Branch Protection Setup - Setup guide
- Fork this repository
- Create a new 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) - Create a Pull Request
feature/*- New featuresfix/*- Bug fixesdocs/*- Documentationrefactor/*- Refactoringtest/*- Add tests
- Author: Kazuki
- Repository: https://github.com/Kazuki-0731/remote-touch