https://github.com/vinayakchandra/remote-mouse
control the mouse cursor remotely in the same network and simulate left and right clicks.
https://github.com/vinayakchandra/remote-mouse
flask pynput python websocket
Last synced: about 2 months ago
JSON representation
control the mouse cursor remotely in the same network and simulate left and right clicks.
- Host: GitHub
- URL: https://github.com/vinayakchandra/remote-mouse
- Owner: vinayakchandra
- Created: 2024-12-04T08:16:40.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-16T18:36:48.000Z (over 1 year ago)
- Last Synced: 2025-03-24T20:17:31.991Z (about 1 year ago)
- Topics: flask, pynput, python, websocket
- Language: HTML
- Homepage: https://vinayakchandra.github.io/Remote-Mouse/
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Remote Mouse Tracker
A web-based application that allows users to control the mouse cursor remotely and simulate left and right clicks. The
application uses `Flask` for the backend, `WebSockets` for real-time communication, and HTML with JavaScript on the
frontend to track mouse movements and handle click events.
## Features
- Track and move the mouse cursor remotely based on user input.
- Simulate left and right mouse clicks through buttons on the web interface.
- Real-time communication between the web interface and Python backend using WebSockets.
## API Endpoints
| Method | Endpoint | Description |
|--------|-------------------------|----------------------------------------------------------------|
| `GET` | `/` | Renders the main `HTML` page with the mouse tracker interface. |
| `GET` | `/left_click` | Simulates a left-click. |
| `GET` | `/right_click` | Simulates a right-click. |
| `WS` | `ws://:8765` | WebSocket connection for real-time mouse position updates. |
You can install the necessary Python libraries using `pip`:
```bash
pip install -r requirements.txt
```
## How to run Project?
```bash
python app.py
```
```bash
python move.py
```
## Flask Backend
The `Flask` application serves the HTML page and has two endpoints:
- `/`: Renders the main page.
- `/left_click` and `/right_click`: Simulate left and right mouse clicks using the `pynput` library.
## WebSocket Server
The `WebSocket` server listens for incoming messages that contain `x` and `y` coordinates, then adjusts the mouse
position
based on those values. It resizes the coordinates to match the system's screen resolution.
## Frontend (HTML + JavaScript)
The frontend listens for mouse movements inside the tracker box and sends the coordinates to the WebSocket server.
It also sends requests to the Flask server to simulate left and right clicks when the corresponding buttons are pressed.
`http://:5000`