laptop-remote 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. laptop_remote-1.0.0/LICENSE +21 -0
  2. laptop_remote-1.0.0/PKG-INFO +339 -0
  3. laptop_remote-1.0.0/README.md +292 -0
  4. laptop_remote-1.0.0/presets.json +77 -0
  5. laptop_remote-1.0.0/pyproject.toml +83 -0
  6. laptop_remote-1.0.0/setup.cfg +4 -0
  7. laptop_remote-1.0.0/src/laptop_remote/__init__.py +8 -0
  8. laptop_remote-1.0.0/src/laptop_remote/__main__.py +8 -0
  9. laptop_remote-1.0.0/src/laptop_remote/cli.py +46 -0
  10. laptop_remote-1.0.0/src/laptop_remote/core/__init__.py +1 -0
  11. laptop_remote-1.0.0/src/laptop_remote/core/audio.py +278 -0
  12. laptop_remote-1.0.0/src/laptop_remote/core/auth.py +116 -0
  13. laptop_remote-1.0.0/src/laptop_remote/core/config.py +116 -0
  14. laptop_remote-1.0.0/src/laptop_remote/core/input.py +694 -0
  15. laptop_remote-1.0.0/src/laptop_remote/core/keys.py +111 -0
  16. laptop_remote-1.0.0/src/laptop_remote/core/network.py +106 -0
  17. laptop_remote-1.0.0/src/laptop_remote/core/overlay.py +171 -0
  18. laptop_remote-1.0.0/src/laptop_remote/core/overlay_x11.py +191 -0
  19. laptop_remote-1.0.0/src/laptop_remote/core/power.py +39 -0
  20. laptop_remote-1.0.0/src/laptop_remote/core/tray.py +135 -0
  21. laptop_remote-1.0.0/src/laptop_remote/core/window.py +51 -0
  22. laptop_remote-1.0.0/src/laptop_remote/server/__init__.py +22 -0
  23. laptop_remote-1.0.0/src/laptop_remote/server/_app.py +71 -0
  24. laptop_remote-1.0.0/src/laptop_remote/server/discovery.py +69 -0
  25. laptop_remote-1.0.0/src/laptop_remote/server/main.py +125 -0
  26. laptop_remote-1.0.0/src/laptop_remote/server/routes_auth.py +140 -0
  27. laptop_remote-1.0.0/src/laptop_remote/server/routes_input.py +129 -0
  28. laptop_remote-1.0.0/src/laptop_remote/server/state.py +23 -0
  29. laptop_remote-1.0.0/src/laptop_remote/server/websocket.py +141 -0
  30. laptop_remote-1.0.0/src/laptop_remote/static/css/base.css +279 -0
  31. laptop_remote-1.0.0/src/laptop_remote/static/css/components.css +1334 -0
  32. laptop_remote-1.0.0/src/laptop_remote/static/css/tokens.css +119 -0
  33. laptop_remote-1.0.0/src/laptop_remote/static/icon.svg +11 -0
  34. laptop_remote-1.0.0/src/laptop_remote/static/index.html +601 -0
  35. laptop_remote-1.0.0/src/laptop_remote/static/js/app.js +118 -0
  36. laptop_remote-1.0.0/src/laptop_remote/static/js/media.js +131 -0
  37. laptop_remote-1.0.0/src/laptop_remote/static/js/presentation.js +166 -0
  38. laptop_remote-1.0.0/src/laptop_remote/static/js/preset-logic.js +17 -0
  39. laptop_remote-1.0.0/src/laptop_remote/static/js/state.js +137 -0
  40. laptop_remote-1.0.0/src/laptop_remote/static/js/trackpad-logic.js +31 -0
  41. laptop_remote-1.0.0/src/laptop_remote/static/js/trackpad.js +310 -0
  42. laptop_remote-1.0.0/src/laptop_remote/static/js/transport.js +210 -0
  43. laptop_remote-1.0.0/src/laptop_remote/static/manifest.webmanifest +16 -0
  44. laptop_remote-1.0.0/src/laptop_remote/static/socket.io.min.js +7 -0
  45. laptop_remote-1.0.0/src/laptop_remote/static/sw.js +5 -0
  46. laptop_remote-1.0.0/src/laptop_remote.egg-info/PKG-INFO +339 -0
  47. laptop_remote-1.0.0/src/laptop_remote.egg-info/SOURCES.txt +55 -0
  48. laptop_remote-1.0.0/src/laptop_remote.egg-info/dependency_links.txt +1 -0
  49. laptop_remote-1.0.0/src/laptop_remote.egg-info/entry_points.txt +2 -0
  50. laptop_remote-1.0.0/src/laptop_remote.egg-info/requires.txt +29 -0
  51. laptop_remote-1.0.0/src/laptop_remote.egg-info/top_level.txt +1 -0
  52. laptop_remote-1.0.0/tests/test_auth.py +74 -0
  53. laptop_remote-1.0.0/tests/test_config.py +52 -0
  54. laptop_remote-1.0.0/tests/test_input.py +234 -0
  55. laptop_remote-1.0.0/tests/test_keys.py +106 -0
  56. laptop_remote-1.0.0/tests/test_overlay_x11.py +232 -0
  57. laptop_remote-1.0.0/tests/test_server_routes.py +61 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sathyabalan Kumaran
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,339 @@
1
+ Metadata-Version: 2.4
2
+ Name: laptop-remote
3
+ Version: 1.0.0
4
+ Summary: Control your laptop from a phone over local Wi-Fi โ€” mouse, keyboard, media, and presentation laser pointer.
5
+ Author: Laptop Remote Contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Sathyabalan6/laptop-remote
8
+ Project-URL: Repository, https://github.com/Sathyabalan6/laptop-remote
9
+ Project-URL: Issues, https://github.com/Sathyabalan6/laptop-remote/issues
10
+ Project-URL: Documentation, https://github.com/Sathyabalan6/laptop-remote#readme
11
+ Keywords: remote,trackpad,mouse,keyboard,media,presentation,laser,wi-fi
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: End Users/Desktop
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: System :: Networking
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: Flask>=3.0
26
+ Requires-Dist: Flask-SocketIO>=5.3
27
+ Requires-Dist: simple-websocket>=1.0
28
+ Requires-Dist: qrcode>=7.4
29
+ Requires-Dist: Pillow>=10.0
30
+ Requires-Dist: pyperclip>=1.8
31
+ Requires-Dist: pyautogui>=0.9.54
32
+ Requires-Dist: python-xlib>=0.33; sys_platform == "linux"
33
+ Requires-Dist: zeroconf>=0.130; sys_platform != "win32"
34
+ Requires-Dist: ifaddr>=0.2
35
+ Provides-Extra: windows
36
+ Requires-Dist: pywin32>=306; extra == "windows"
37
+ Requires-Dist: pycaw>=20240210; extra == "windows"
38
+ Requires-Dist: comtypes>=1.2.0; extra == "windows"
39
+ Provides-Extra: tray
40
+ Requires-Dist: pystray>=0.19; extra == "tray"
41
+ Provides-Extra: build
42
+ Requires-Dist: pyinstaller>=6.0; extra == "build"
43
+ Provides-Extra: dev
44
+ Requires-Dist: pytest>=7.4; extra == "dev"
45
+ Requires-Dist: pytest-cov>=4.1; extra == "dev"
46
+ Dynamic: license-file
47
+
48
+ # ๐Ÿ“ฑ Laptop Remote (Remote Deck)
49
+
50
+ [![CI](https://github.com/Sathyabalan6/laptop-remote/actions/workflows/ci.yml/badge.svg)](https://github.com/Sathyabalan6/laptop-remote/actions/workflows/ci.yml)
51
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
52
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
53
+ [![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey.svg)](#-platform-support)
54
+
55
+ > Turn your smartphone into a powerful, low-latency remote control for your laptop. Control media playback, stream a high-precision trackpad, navigate with a virtual D-Pad and keyboard, and present with a real-time screen laser pointer.
56
+
57
+ <p align="center">
58
+ <img src="docs/images/laser-trackpad-demo.gif" alt="Laser Pointer & Trackpad Demo" width="650">
59
+ </p>
60
+
61
+ > โš ๏ธ **LAN-only tool.** Designed for trusted local networks (home Wi-Fi / hotspot). Do **not** expose it to the public internet โ€” see [SECURITY.md](SECURITY.md).
62
+
63
+ ---
64
+
65
+ ## ๐Ÿ“ธ Screenshots
66
+
67
+ | Media Controls | Touch Trackpad | Virtual Mouse | Presentation Deck |
68
+ | :---: | :---: | :---: | :---: |
69
+ | ![Media Controls](docs/images/media.png) | ![Touch Trackpad](docs/images/trackpad.png) | ![Virtual Mouse](docs/images/mouse.png) | ![Presentation](docs/images/presentation.png) |
70
+
71
+ <details>
72
+ <summary><b>๐Ÿ‘€ View Real-World & Desktop Companion Preview</b></summary>
73
+ <br>
74
+
75
+ | Laptop Terminal Server | Phone Controlling Laptop |
76
+ | :---: | :---: |
77
+ | ![Laptop Terminal](docs/images/laptopScreen.png) | ![Phone Remote](docs/images/mobilescreen.jpeg) |
78
+
79
+ </details>
80
+
81
+ ---
82
+
83
+ ## โœจ Features at a Glance
84
+
85
+ * **โšก Terminal / Headless Edition**: A lightweight, no-GUI server that prints a QR code and pairing PIN directly in the terminal.
86
+ * **๐ŸŒ Zero-Config Discovery**: Connect instantly via QR code scan, local IP, or mDNS (`http://remotedeck.local:5000`).
87
+ * **๐Ÿ”’ Secure PIN Pairing**: Protected with 6-digit rolling PIN verification, session Bearer tokens, and brute-force IP rate limiting.
88
+ * **๐ŸŽต Smart Media Deck**: Context-aware media controls for YouTube, Netflix, Disney+ Hotstar, Prime Video, VLC, and web players.
89
+ * **๐Ÿ” Auto-Profile Detection**: Automatically detects the active foreground window and switches key mappings on the fly.
90
+ * **๐Ÿ–ฑ๏ธ Low-Latency Trackpad**: Smooth mouse movement powered by WebSockets, native OS input simulation, DPI scaling, tap-to-click, and 2-finger inertia scrolling.
91
+ * **โŒจ๏ธ Keyboard & Navigation Keypad**: Send text input/search queries directly to your laptop, use a 5-way D-Pad, and trigger 1-touch hotkey tiles (skip intro, cycle audio tracks, speed +/-).
92
+ * **๐Ÿ“Š Presentation Mode with Laser Pointer**: Projects a red laser dot across your laptop screen in real time, with slide controls, blackout mode, and an elapsed presentation timer.
93
+ * **๐Ÿ“ฑ Progressive Web App (PWA)**: Installable to your phone's home screen for a distraction-free, full-screen remote experience.
94
+ * **๐Ÿ”‹ Host Status**: Live laptop battery percentage and active profile indicators.
95
+
96
+ ---
97
+
98
+ ## ๐Ÿš€ Quick Start
99
+
100
+ ### From a prebuilt executable (`LaptopRemote-CLI.exe`)
101
+
102
+ 1. **Launch**: Double-click `dist/LaptopRemote-CLI.exe` (or run it from a terminal).
103
+ 2. **Scan & Connect**:
104
+ * Ensure your phone and laptop are on the **same Wi-Fi network** (or phone hotspot).
105
+ * Scan the **QR Code** printed in the terminal with your phone's camera, or navigate to the displayed URL (e.g., `http://192.168.1.X:5000` or `http://remotedeck.local:5000`).
106
+ 3. **Pair**: Enter the **6-digit Pairing PIN** shown in the terminal.
107
+ 4. **Enjoy**: Use the remote from your phone browser or install it as a PWA!
108
+
109
+ ### From source (Python 3.10+)
110
+
111
+ ```bash
112
+ # One-time: install dependencies
113
+ pip install -e .
114
+
115
+ # Run with an auto-generated PIN and ASCII QR code
116
+ python -m laptop_remote
117
+
118
+ # Run with a custom PIN / different port
119
+ python -m laptop_remote --pin 123456 --port 5000
120
+
121
+ # Enable HTTPS/WSS (self-signed cert auto-generated)
122
+ python -m laptop_remote --ssl
123
+ ```
124
+
125
+ Or use the Linux launcher (also sets up Wayland mouse support if needed):
126
+
127
+ ```bash
128
+ ./run.sh
129
+ ```
130
+
131
+ ---
132
+
133
+ ## ๐Ÿ› ๏ธ Remote Deck Controls & Tabs
134
+
135
+ ### ๐ŸŽต 1. Media Tab
136
+ * **Active Profile**: Auto-detects or lets you manually switch between **YouTube / Hotstar**, **VLC Media Player**, and **Universal (Netflix / Prime / Web)**.
137
+ * **Playback Controls**: Play / Pause toggle, Skip Backward 10s (`โช`), Skip Forward 10s (`โฉ`), Fast Skip 30s (`โญ๏ธ`).
138
+ * **Navigation & View**: Previous / Next episode/track, Fullscreen toggle (`โ›ถ`).
139
+ * **๐Ÿ”Š OS-Level Audio Controls**: Volume Up, Volume Down, and Mute buttons adjust the host system volume directly โ€” ensuring 100% reliability regardless of browser focus or scrolling.
140
+ * **๐Ÿ’ฌ Subtitles & Tracks**: One-tap toggle for closed captions, subtitle sync delay/advance (`Z` / `Shift+Z` / `G` / `H`), and multi-language audio stream cycling.
141
+
142
+ ---
143
+
144
+ ### ๐Ÿ–ฑ๏ธ 2. Mouse & Trackpad Tab
145
+ * **High-Precision Trackpad**: Move cursor with one finger. Backed by native OS cursor calls (`win32api` / macOS Quartz) with DPI-scaled acceleration curves for smooth, responsive movement.
146
+ * **Tap-to-Click**: Tap trackpad surface for instant left-click.
147
+ * **Physical Click Buttons**: Dedicated Left Click and Right Click pads.
148
+ * **2-Finger Momentum Scroll**: Drag with two fingers to scroll web pages, documents, or timelines with natural physics decay.
149
+ * **Sensitivity Slider**: Fine-tune cursor speed and acceleration response directly from your phone.
150
+
151
+ ---
152
+
153
+ ### โŒจ๏ธ 3. Keyboard & Keypad Tab
154
+ * **Live Search & Text Typing**: Type queries or URLs on your phone and press **Search** to send them to the active text field on your laptop (supports rapid clipboard pasting).
155
+ * **Targeted Focus**:
156
+ * `/ Focus Search`: Focuses in-page search bars on YouTube, streaming sites, and web apps.
157
+ * `Ctrl+L URL Bar`: Immediately jumps focus to the browser's address bar.
158
+ * **5-Way D-Pad & Navigation**: Dedicated `Up`, `Down`, `Left`, `Right`, and `OK` (Enter) buttons, plus `ESC`, `TAB`, `โ‡ง TAB`, and `Backspace`.
159
+ * **Streaming & Quick Hotkey Grid**:
160
+ | Hotkey Tile | Shortcut Action | Supported Apps |
161
+ | :--- | :--- | :--- |
162
+ | **Skip Intro** (`S`) | Skips intros & recaps | Netflix, Prime, Hotstar |
163
+ | **Theater Mode** (`T`) | Expands player view | YouTube, Twitch |
164
+ | **Miniplayer** (`I`) | Picture-in-Picture mode | YouTube, Browsers |
165
+ | **Audio Dub** (`A`/`B`) | Cycle audio language tracks | VLC, Streaming |
166
+ | **Speed +/-** (`>`/`<`) | Speed up / slow down playback | YouTube, VLC |
167
+ | **Sub Sync +/-** | Shift subtitle timing forward/back | VLC, Media Players |
168
+ | **Next Tab** (`Ctrl+Tab`)| Cycle forward through browser tabs | Chrome, Firefox, Edge |
169
+ | **Reload** (`F5`) | Refresh current web page | All Browsers |
170
+ | **Sub Size +/-** | Increase or decrease caption font size | Supported Players |
171
+
172
+ ---
173
+
174
+ ### ๐Ÿ“Š 4. Present Tab
175
+ * **Screen Laser Pointer**: Touch and drag your finger across the pad to project a smooth, hardware-rendered red laser dot over your laptop screen in real time.
176
+ * **Slide Navigation**: Dedicated Next Slide and Previous Slide buttons.
177
+ * **Auto-Start Presentation**: Mapped to `F5` (or `Ctrl+F5` when Google Slides, Canva, Prezi, or Docs are active).
178
+ * **Blackout Screen**: Blank the laptop display with one tap during presentations or breaks.
179
+ * **Slide Counter & Live Timer**: Track slide numbers and presentation duration automatically from first touch.
180
+
181
+ ---
182
+
183
+ ## ๐Ÿ”’ Security & Connection Details
184
+
185
+ * **Rolling One-Time PIN**: A fresh 6-digit PIN is generated upon startup and regenerated after each successful pairing or manual revocation.
186
+ * **Brute-Force Protection**: IP-based lockout triggers automatically after 5 consecutive incorrect PIN attempts (30-second escalating lockout).
187
+ * **Bearer Token Authorization**: Paired devices receive a cryptographically secure 48-character session token stored locally on your device.
188
+ * **Dual Transport**: High-frequency mouse coordinates and laser pointer positions stream over **WebSockets** for minimal latency, with automatic fallback to REST endpoints if required.
189
+ * **Offline Self-Contained**: Socket.IO client library and assets are fully bundled locally โ€” **no internet connection or CDN required**.
190
+
191
+ ---
192
+
193
+ ## โš™๏ธ Configuration & Custom Presets
194
+
195
+ Key mappings are defined in [`presets.json`](file:///E:/laptop-remote/presets.json). You can customize or add hotkeys for your favorite applications:
196
+
197
+ ```json
198
+ {
199
+ "youtube_hotstar": {
200
+ "play_pause": "space",
201
+ "skip_forward": "l",
202
+ "skip_back": "j",
203
+ "skip_forward_30": ["l", "l", "l"],
204
+ "next": ["shift", "n"],
205
+ "fullscreen": "f",
206
+ "subtitles": "c",
207
+ "speed_up": ["shift", "."]
208
+ },
209
+ "universal": {
210
+ "play_pause": "space",
211
+ "skip_forward": "right",
212
+ "skip_back": "left",
213
+ "fullscreen": "f"
214
+ }
215
+ }
216
+ ```
217
+
218
+ ---
219
+
220
+ ## ๐Ÿ’ป Developer Setup & Building Executables
221
+
222
+ ### Prerequisites
223
+ * Python 3.10+ installed and added to your system `PATH`.
224
+
225
+ ### Running from Source
226
+ ```bash
227
+ # Install the package in editable mode (pulls in all dependencies)
228
+ pip install -e .
229
+
230
+ # Run the server (terminal edition)
231
+ python -m laptop_remote
232
+ ```
233
+
234
+ ### Compiling a Standalone Executable (`.exe`)
235
+
236
+ * **Windows**: Double-click **`build.bat`** to build `dist/LaptopRemote-CLI.exe`.
237
+ * **Linux**: Run **`./build.sh`** to build `dist/LaptopRemote-CLI`.
238
+
239
+ ---
240
+
241
+ ## ๐Ÿ“ Project Structure
242
+
243
+ ```
244
+ laptop-remote/
245
+ โ”œโ”€โ”€ pyproject.toml # Packaging metadata & dependencies
246
+ โ”œโ”€โ”€ requirements.txt # Runtime dependencies
247
+ โ”œโ”€โ”€ run.sh / build.sh # Linux launcher / builder
248
+ โ”œโ”€โ”€ build.bat / build_cli.bat # Windows builders
249
+ โ”œโ”€โ”€ setup_linux.sh # One-time Wayland (ydotool) setup on Linux
250
+ โ”œโ”€โ”€ presets.json # Keyboard shortcut profiles (user-editable)
251
+ โ”œโ”€โ”€ logo.ico # App icon
252
+ โ”œโ”€โ”€ src/
253
+ โ”‚ โ””โ”€โ”€ laptop_remote/ # Main application package
254
+ โ”‚ โ”œโ”€โ”€ __init__.py
255
+ โ”‚ โ”œโ”€โ”€ __main__.py # python -m laptop_remote
256
+ โ”‚ โ”œโ”€โ”€ server/ # Flask + SocketIO server package
257
+ โ”‚ โ”‚ โ”œโ”€โ”€ __init__.py # public API (app, socketio, main)
258
+ โ”‚ โ”‚ โ”œโ”€โ”€ _app.py # app construction & shared runtime state
259
+ โ”‚ โ”‚ โ”œโ”€โ”€ state.py # build_state()
260
+ โ”‚ โ”‚ โ”œโ”€โ”€ routes_auth.py # pairing, revoke, QR
261
+ โ”‚ โ”‚ โ”œโ”€โ”€ routes_input.py # mouse/key/text/pointer/volume
262
+ โ”‚ โ”‚ โ”œโ”€โ”€ websocket.py # Socket.IO handlers
263
+ โ”‚ โ”‚ โ”œโ”€โ”€ discovery.py # mDNS + preset monitor
264
+ โ”‚ โ”‚ โ””โ”€โ”€ main.py # main() entry point
265
+ โ”‚ โ”œโ”€โ”€ cli.py # Terminal/headless entry point
266
+ โ”‚ โ”œโ”€โ”€ core/ # Platform backends & utilities
267
+ โ”‚ โ”‚ โ”œโ”€โ”€ input.py # Mouse/keyboard drivers (Windows/macOS/X11/Wayland)
268
+ โ”‚ โ”‚ โ”œโ”€โ”€ keys.py # Key-name โ†’ Linux input-event keycode mapping
269
+ โ”‚ โ”‚ โ”œโ”€โ”€ auth.py # PIN generation, bearer tokens, rate limiting
270
+ โ”‚ โ”‚ โ”œโ”€โ”€ config.py # Presets JSON loader & path resolver
271
+ โ”‚ โ”‚ โ”œโ”€โ”€ network.py # Local IP resolution & SSL certificate setup
272
+ โ”‚ โ”‚ โ”œโ”€โ”€ overlay.py # Platform selection and Windows overlay
273
+ โ”‚ โ”‚ โ”œโ”€โ”€ overlay_x11.py # Linux X11 SHAPE overlay
274
+ โ”‚ โ”‚ โ”œโ”€โ”€ power.py # Battery status monitor
275
+ โ”‚ โ”‚ โ”œโ”€โ”€ window.py # Foreground window detection & auto-preset
276
+ โ”‚ โ”‚ โ”œโ”€โ”€ audio.py # Cross-platform volume control
277
+ โ”‚ โ”‚ โ””โ”€โ”€ tray.py # System tray icon manager
278
+ โ”‚ โ””โ”€โ”€ static/ # Web frontend (served as the remote UI)
279
+ โ”‚ โ”œโ”€โ”€ index.html
280
+ โ”‚ โ”œโ”€โ”€ css/ # tokens.css, base.css, components.css
281
+ โ”‚ โ””โ”€โ”€ js/ # app.js, transport.js, trackpad.js, ...
282
+ โ”œโ”€โ”€ docs/ # Design notes & research
283
+ โ”œโ”€โ”€ tests/ # pytest test suite
284
+ โ””โ”€โ”€ README.md
285
+ ```
286
+
287
+ ---
288
+
289
+ ## ๐Ÿ–ฅ๏ธ Platform Support
290
+
291
+ | Platform | Mouse / Keyboard | Presentation Laser Pointer |
292
+ |---|---|---|
293
+ | **Windows** | โœ… Native (`win32api`) | โœ… Red dot overlay |
294
+ | **macOS** | โœ… Native (`Quartz`) | โŒ Not yet |
295
+ | **Linux (X11)** | pyautogui / XTest | X11 SHAPE 1.1 overlay |
296
+ | **Linux (Wayland)** | ydotool / dotool; one-time setup_linux.sh | XWayland only when DISPLAY and SHAPE 1.1 are available |
297
+
298
+ > **Laser pointer note:** Windows uses its native Tk overlay. Linux uses an X11
299
+ > SHAPE 1.1 window with an empty input shape so mouse and touch events pass through.
300
+ > A direct Wayland session is not supported. XWayland availability depends on its
301
+ > display exposing SHAPE 1.1; if initialization fails, the app reports the pointer
302
+ > unavailable and keeps the laser pad hidden. macOS support is not yet implemented.
303
+
304
+ ---
305
+
306
+ ## ๐Ÿงช Running Tests
307
+
308
+ ```bash
309
+ pip install -e ".[dev]"
310
+ pytest
311
+ ```
312
+
313
+ Tests run automatically on Linux, Windows, and macOS via GitHub Actions.
314
+
315
+ ---
316
+
317
+ ## ๐Ÿค Contributing
318
+
319
+ Contributions are very welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for setup
320
+ instructions, coding guidelines, and platform testing notes. Please also read our
321
+ [Code of Conduct](CODE_OF_CONDUCT.md).
322
+
323
+ - ๐Ÿ› [Report a bug](https://github.com/Sathyabalan6/laptop-remote/issues/new?template=bug_report.yml)
324
+ - โœจ [Request a feature](https://github.com/Sathyabalan6/laptop-remote/issues/new?template=feature_request.yml)
325
+ - ๐Ÿ’ฌ [Ask a question](https://github.com/Sathyabalan6/laptop-remote/discussions)
326
+
327
+ ---
328
+
329
+ ## ๐Ÿ” Security
330
+
331
+ This is a **LAN-only** tool. Please read [SECURITY.md](SECURITY.md) before
332
+ reporting vulnerabilities or deploying it.
333
+
334
+ ---
335
+
336
+ ## ๐Ÿ“„ License
337
+
338
+ This project is licensed under the **MIT License** โ€” see [LICENSE](LICENSE).
339
+ Free to use, modify, and distribute for personal and commercial purposes.
@@ -0,0 +1,292 @@
1
+ # ๐Ÿ“ฑ Laptop Remote (Remote Deck)
2
+
3
+ [![CI](https://github.com/Sathyabalan6/laptop-remote/actions/workflows/ci.yml/badge.svg)](https://github.com/Sathyabalan6/laptop-remote/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
5
+ [![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
6
+ [![Platform](https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey.svg)](#-platform-support)
7
+
8
+ > Turn your smartphone into a powerful, low-latency remote control for your laptop. Control media playback, stream a high-precision trackpad, navigate with a virtual D-Pad and keyboard, and present with a real-time screen laser pointer.
9
+
10
+ <p align="center">
11
+ <img src="docs/images/laser-trackpad-demo.gif" alt="Laser Pointer & Trackpad Demo" width="650">
12
+ </p>
13
+
14
+ > โš ๏ธ **LAN-only tool.** Designed for trusted local networks (home Wi-Fi / hotspot). Do **not** expose it to the public internet โ€” see [SECURITY.md](SECURITY.md).
15
+
16
+ ---
17
+
18
+ ## ๐Ÿ“ธ Screenshots
19
+
20
+ | Media Controls | Touch Trackpad | Virtual Mouse | Presentation Deck |
21
+ | :---: | :---: | :---: | :---: |
22
+ | ![Media Controls](docs/images/media.png) | ![Touch Trackpad](docs/images/trackpad.png) | ![Virtual Mouse](docs/images/mouse.png) | ![Presentation](docs/images/presentation.png) |
23
+
24
+ <details>
25
+ <summary><b>๐Ÿ‘€ View Real-World & Desktop Companion Preview</b></summary>
26
+ <br>
27
+
28
+ | Laptop Terminal Server | Phone Controlling Laptop |
29
+ | :---: | :---: |
30
+ | ![Laptop Terminal](docs/images/laptopScreen.png) | ![Phone Remote](docs/images/mobilescreen.jpeg) |
31
+
32
+ </details>
33
+
34
+ ---
35
+
36
+ ## โœจ Features at a Glance
37
+
38
+ * **โšก Terminal / Headless Edition**: A lightweight, no-GUI server that prints a QR code and pairing PIN directly in the terminal.
39
+ * **๐ŸŒ Zero-Config Discovery**: Connect instantly via QR code scan, local IP, or mDNS (`http://remotedeck.local:5000`).
40
+ * **๐Ÿ”’ Secure PIN Pairing**: Protected with 6-digit rolling PIN verification, session Bearer tokens, and brute-force IP rate limiting.
41
+ * **๐ŸŽต Smart Media Deck**: Context-aware media controls for YouTube, Netflix, Disney+ Hotstar, Prime Video, VLC, and web players.
42
+ * **๐Ÿ” Auto-Profile Detection**: Automatically detects the active foreground window and switches key mappings on the fly.
43
+ * **๐Ÿ–ฑ๏ธ Low-Latency Trackpad**: Smooth mouse movement powered by WebSockets, native OS input simulation, DPI scaling, tap-to-click, and 2-finger inertia scrolling.
44
+ * **โŒจ๏ธ Keyboard & Navigation Keypad**: Send text input/search queries directly to your laptop, use a 5-way D-Pad, and trigger 1-touch hotkey tiles (skip intro, cycle audio tracks, speed +/-).
45
+ * **๐Ÿ“Š Presentation Mode with Laser Pointer**: Projects a red laser dot across your laptop screen in real time, with slide controls, blackout mode, and an elapsed presentation timer.
46
+ * **๐Ÿ“ฑ Progressive Web App (PWA)**: Installable to your phone's home screen for a distraction-free, full-screen remote experience.
47
+ * **๐Ÿ”‹ Host Status**: Live laptop battery percentage and active profile indicators.
48
+
49
+ ---
50
+
51
+ ## ๐Ÿš€ Quick Start
52
+
53
+ ### From a prebuilt executable (`LaptopRemote-CLI.exe`)
54
+
55
+ 1. **Launch**: Double-click `dist/LaptopRemote-CLI.exe` (or run it from a terminal).
56
+ 2. **Scan & Connect**:
57
+ * Ensure your phone and laptop are on the **same Wi-Fi network** (or phone hotspot).
58
+ * Scan the **QR Code** printed in the terminal with your phone's camera, or navigate to the displayed URL (e.g., `http://192.168.1.X:5000` or `http://remotedeck.local:5000`).
59
+ 3. **Pair**: Enter the **6-digit Pairing PIN** shown in the terminal.
60
+ 4. **Enjoy**: Use the remote from your phone browser or install it as a PWA!
61
+
62
+ ### From source (Python 3.10+)
63
+
64
+ ```bash
65
+ # One-time: install dependencies
66
+ pip install -e .
67
+
68
+ # Run with an auto-generated PIN and ASCII QR code
69
+ python -m laptop_remote
70
+
71
+ # Run with a custom PIN / different port
72
+ python -m laptop_remote --pin 123456 --port 5000
73
+
74
+ # Enable HTTPS/WSS (self-signed cert auto-generated)
75
+ python -m laptop_remote --ssl
76
+ ```
77
+
78
+ Or use the Linux launcher (also sets up Wayland mouse support if needed):
79
+
80
+ ```bash
81
+ ./run.sh
82
+ ```
83
+
84
+ ---
85
+
86
+ ## ๐Ÿ› ๏ธ Remote Deck Controls & Tabs
87
+
88
+ ### ๐ŸŽต 1. Media Tab
89
+ * **Active Profile**: Auto-detects or lets you manually switch between **YouTube / Hotstar**, **VLC Media Player**, and **Universal (Netflix / Prime / Web)**.
90
+ * **Playback Controls**: Play / Pause toggle, Skip Backward 10s (`โช`), Skip Forward 10s (`โฉ`), Fast Skip 30s (`โญ๏ธ`).
91
+ * **Navigation & View**: Previous / Next episode/track, Fullscreen toggle (`โ›ถ`).
92
+ * **๐Ÿ”Š OS-Level Audio Controls**: Volume Up, Volume Down, and Mute buttons adjust the host system volume directly โ€” ensuring 100% reliability regardless of browser focus or scrolling.
93
+ * **๐Ÿ’ฌ Subtitles & Tracks**: One-tap toggle for closed captions, subtitle sync delay/advance (`Z` / `Shift+Z` / `G` / `H`), and multi-language audio stream cycling.
94
+
95
+ ---
96
+
97
+ ### ๐Ÿ–ฑ๏ธ 2. Mouse & Trackpad Tab
98
+ * **High-Precision Trackpad**: Move cursor with one finger. Backed by native OS cursor calls (`win32api` / macOS Quartz) with DPI-scaled acceleration curves for smooth, responsive movement.
99
+ * **Tap-to-Click**: Tap trackpad surface for instant left-click.
100
+ * **Physical Click Buttons**: Dedicated Left Click and Right Click pads.
101
+ * **2-Finger Momentum Scroll**: Drag with two fingers to scroll web pages, documents, or timelines with natural physics decay.
102
+ * **Sensitivity Slider**: Fine-tune cursor speed and acceleration response directly from your phone.
103
+
104
+ ---
105
+
106
+ ### โŒจ๏ธ 3. Keyboard & Keypad Tab
107
+ * **Live Search & Text Typing**: Type queries or URLs on your phone and press **Search** to send them to the active text field on your laptop (supports rapid clipboard pasting).
108
+ * **Targeted Focus**:
109
+ * `/ Focus Search`: Focuses in-page search bars on YouTube, streaming sites, and web apps.
110
+ * `Ctrl+L URL Bar`: Immediately jumps focus to the browser's address bar.
111
+ * **5-Way D-Pad & Navigation**: Dedicated `Up`, `Down`, `Left`, `Right`, and `OK` (Enter) buttons, plus `ESC`, `TAB`, `โ‡ง TAB`, and `Backspace`.
112
+ * **Streaming & Quick Hotkey Grid**:
113
+ | Hotkey Tile | Shortcut Action | Supported Apps |
114
+ | :--- | :--- | :--- |
115
+ | **Skip Intro** (`S`) | Skips intros & recaps | Netflix, Prime, Hotstar |
116
+ | **Theater Mode** (`T`) | Expands player view | YouTube, Twitch |
117
+ | **Miniplayer** (`I`) | Picture-in-Picture mode | YouTube, Browsers |
118
+ | **Audio Dub** (`A`/`B`) | Cycle audio language tracks | VLC, Streaming |
119
+ | **Speed +/-** (`>`/`<`) | Speed up / slow down playback | YouTube, VLC |
120
+ | **Sub Sync +/-** | Shift subtitle timing forward/back | VLC, Media Players |
121
+ | **Next Tab** (`Ctrl+Tab`)| Cycle forward through browser tabs | Chrome, Firefox, Edge |
122
+ | **Reload** (`F5`) | Refresh current web page | All Browsers |
123
+ | **Sub Size +/-** | Increase or decrease caption font size | Supported Players |
124
+
125
+ ---
126
+
127
+ ### ๐Ÿ“Š 4. Present Tab
128
+ * **Screen Laser Pointer**: Touch and drag your finger across the pad to project a smooth, hardware-rendered red laser dot over your laptop screen in real time.
129
+ * **Slide Navigation**: Dedicated Next Slide and Previous Slide buttons.
130
+ * **Auto-Start Presentation**: Mapped to `F5` (or `Ctrl+F5` when Google Slides, Canva, Prezi, or Docs are active).
131
+ * **Blackout Screen**: Blank the laptop display with one tap during presentations or breaks.
132
+ * **Slide Counter & Live Timer**: Track slide numbers and presentation duration automatically from first touch.
133
+
134
+ ---
135
+
136
+ ## ๐Ÿ”’ Security & Connection Details
137
+
138
+ * **Rolling One-Time PIN**: A fresh 6-digit PIN is generated upon startup and regenerated after each successful pairing or manual revocation.
139
+ * **Brute-Force Protection**: IP-based lockout triggers automatically after 5 consecutive incorrect PIN attempts (30-second escalating lockout).
140
+ * **Bearer Token Authorization**: Paired devices receive a cryptographically secure 48-character session token stored locally on your device.
141
+ * **Dual Transport**: High-frequency mouse coordinates and laser pointer positions stream over **WebSockets** for minimal latency, with automatic fallback to REST endpoints if required.
142
+ * **Offline Self-Contained**: Socket.IO client library and assets are fully bundled locally โ€” **no internet connection or CDN required**.
143
+
144
+ ---
145
+
146
+ ## โš™๏ธ Configuration & Custom Presets
147
+
148
+ Key mappings are defined in [`presets.json`](file:///E:/laptop-remote/presets.json). You can customize or add hotkeys for your favorite applications:
149
+
150
+ ```json
151
+ {
152
+ "youtube_hotstar": {
153
+ "play_pause": "space",
154
+ "skip_forward": "l",
155
+ "skip_back": "j",
156
+ "skip_forward_30": ["l", "l", "l"],
157
+ "next": ["shift", "n"],
158
+ "fullscreen": "f",
159
+ "subtitles": "c",
160
+ "speed_up": ["shift", "."]
161
+ },
162
+ "universal": {
163
+ "play_pause": "space",
164
+ "skip_forward": "right",
165
+ "skip_back": "left",
166
+ "fullscreen": "f"
167
+ }
168
+ }
169
+ ```
170
+
171
+ ---
172
+
173
+ ## ๐Ÿ’ป Developer Setup & Building Executables
174
+
175
+ ### Prerequisites
176
+ * Python 3.10+ installed and added to your system `PATH`.
177
+
178
+ ### Running from Source
179
+ ```bash
180
+ # Install the package in editable mode (pulls in all dependencies)
181
+ pip install -e .
182
+
183
+ # Run the server (terminal edition)
184
+ python -m laptop_remote
185
+ ```
186
+
187
+ ### Compiling a Standalone Executable (`.exe`)
188
+
189
+ * **Windows**: Double-click **`build.bat`** to build `dist/LaptopRemote-CLI.exe`.
190
+ * **Linux**: Run **`./build.sh`** to build `dist/LaptopRemote-CLI`.
191
+
192
+ ---
193
+
194
+ ## ๐Ÿ“ Project Structure
195
+
196
+ ```
197
+ laptop-remote/
198
+ โ”œโ”€โ”€ pyproject.toml # Packaging metadata & dependencies
199
+ โ”œโ”€โ”€ requirements.txt # Runtime dependencies
200
+ โ”œโ”€โ”€ run.sh / build.sh # Linux launcher / builder
201
+ โ”œโ”€โ”€ build.bat / build_cli.bat # Windows builders
202
+ โ”œโ”€โ”€ setup_linux.sh # One-time Wayland (ydotool) setup on Linux
203
+ โ”œโ”€โ”€ presets.json # Keyboard shortcut profiles (user-editable)
204
+ โ”œโ”€โ”€ logo.ico # App icon
205
+ โ”œโ”€โ”€ src/
206
+ โ”‚ โ””โ”€โ”€ laptop_remote/ # Main application package
207
+ โ”‚ โ”œโ”€โ”€ __init__.py
208
+ โ”‚ โ”œโ”€โ”€ __main__.py # python -m laptop_remote
209
+ โ”‚ โ”œโ”€โ”€ server/ # Flask + SocketIO server package
210
+ โ”‚ โ”‚ โ”œโ”€โ”€ __init__.py # public API (app, socketio, main)
211
+ โ”‚ โ”‚ โ”œโ”€โ”€ _app.py # app construction & shared runtime state
212
+ โ”‚ โ”‚ โ”œโ”€โ”€ state.py # build_state()
213
+ โ”‚ โ”‚ โ”œโ”€โ”€ routes_auth.py # pairing, revoke, QR
214
+ โ”‚ โ”‚ โ”œโ”€โ”€ routes_input.py # mouse/key/text/pointer/volume
215
+ โ”‚ โ”‚ โ”œโ”€โ”€ websocket.py # Socket.IO handlers
216
+ โ”‚ โ”‚ โ”œโ”€โ”€ discovery.py # mDNS + preset monitor
217
+ โ”‚ โ”‚ โ””โ”€โ”€ main.py # main() entry point
218
+ โ”‚ โ”œโ”€โ”€ cli.py # Terminal/headless entry point
219
+ โ”‚ โ”œโ”€โ”€ core/ # Platform backends & utilities
220
+ โ”‚ โ”‚ โ”œโ”€โ”€ input.py # Mouse/keyboard drivers (Windows/macOS/X11/Wayland)
221
+ โ”‚ โ”‚ โ”œโ”€โ”€ keys.py # Key-name โ†’ Linux input-event keycode mapping
222
+ โ”‚ โ”‚ โ”œโ”€โ”€ auth.py # PIN generation, bearer tokens, rate limiting
223
+ โ”‚ โ”‚ โ”œโ”€โ”€ config.py # Presets JSON loader & path resolver
224
+ โ”‚ โ”‚ โ”œโ”€โ”€ network.py # Local IP resolution & SSL certificate setup
225
+ โ”‚ โ”‚ โ”œโ”€โ”€ overlay.py # Platform selection and Windows overlay
226
+ โ”‚ โ”‚ โ”œโ”€โ”€ overlay_x11.py # Linux X11 SHAPE overlay
227
+ โ”‚ โ”‚ โ”œโ”€โ”€ power.py # Battery status monitor
228
+ โ”‚ โ”‚ โ”œโ”€โ”€ window.py # Foreground window detection & auto-preset
229
+ โ”‚ โ”‚ โ”œโ”€โ”€ audio.py # Cross-platform volume control
230
+ โ”‚ โ”‚ โ””โ”€โ”€ tray.py # System tray icon manager
231
+ โ”‚ โ””โ”€โ”€ static/ # Web frontend (served as the remote UI)
232
+ โ”‚ โ”œโ”€โ”€ index.html
233
+ โ”‚ โ”œโ”€โ”€ css/ # tokens.css, base.css, components.css
234
+ โ”‚ โ””โ”€โ”€ js/ # app.js, transport.js, trackpad.js, ...
235
+ โ”œโ”€โ”€ docs/ # Design notes & research
236
+ โ”œโ”€โ”€ tests/ # pytest test suite
237
+ โ””โ”€โ”€ README.md
238
+ ```
239
+
240
+ ---
241
+
242
+ ## ๐Ÿ–ฅ๏ธ Platform Support
243
+
244
+ | Platform | Mouse / Keyboard | Presentation Laser Pointer |
245
+ |---|---|---|
246
+ | **Windows** | โœ… Native (`win32api`) | โœ… Red dot overlay |
247
+ | **macOS** | โœ… Native (`Quartz`) | โŒ Not yet |
248
+ | **Linux (X11)** | pyautogui / XTest | X11 SHAPE 1.1 overlay |
249
+ | **Linux (Wayland)** | ydotool / dotool; one-time setup_linux.sh | XWayland only when DISPLAY and SHAPE 1.1 are available |
250
+
251
+ > **Laser pointer note:** Windows uses its native Tk overlay. Linux uses an X11
252
+ > SHAPE 1.1 window with an empty input shape so mouse and touch events pass through.
253
+ > A direct Wayland session is not supported. XWayland availability depends on its
254
+ > display exposing SHAPE 1.1; if initialization fails, the app reports the pointer
255
+ > unavailable and keeps the laser pad hidden. macOS support is not yet implemented.
256
+
257
+ ---
258
+
259
+ ## ๐Ÿงช Running Tests
260
+
261
+ ```bash
262
+ pip install -e ".[dev]"
263
+ pytest
264
+ ```
265
+
266
+ Tests run automatically on Linux, Windows, and macOS via GitHub Actions.
267
+
268
+ ---
269
+
270
+ ## ๐Ÿค Contributing
271
+
272
+ Contributions are very welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for setup
273
+ instructions, coding guidelines, and platform testing notes. Please also read our
274
+ [Code of Conduct](CODE_OF_CONDUCT.md).
275
+
276
+ - ๐Ÿ› [Report a bug](https://github.com/Sathyabalan6/laptop-remote/issues/new?template=bug_report.yml)
277
+ - โœจ [Request a feature](https://github.com/Sathyabalan6/laptop-remote/issues/new?template=feature_request.yml)
278
+ - ๐Ÿ’ฌ [Ask a question](https://github.com/Sathyabalan6/laptop-remote/discussions)
279
+
280
+ ---
281
+
282
+ ## ๐Ÿ” Security
283
+
284
+ This is a **LAN-only** tool. Please read [SECURITY.md](SECURITY.md) before
285
+ reporting vulnerabilities or deploying it.
286
+
287
+ ---
288
+
289
+ ## ๐Ÿ“„ License
290
+
291
+ This project is licensed under the **MIT License** โ€” see [LICENSE](LICENSE).
292
+ Free to use, modify, and distribute for personal and commercial purposes.