Browser pad
Part of lemoGamePad ultimate.
The PC server can host its own gamepad page. Open it in any modern browser on the same Wi-Fi and the phone, tablet or laptop becomes a controller — no Android app, no account and no internet connection.
The page is served by the PC, uses only local files and talks to the server over a WebSocket on the local network. It never loads a CDN script, web font, analytics service or any other remote resource. It mirrors the Android pad: the same ten themes, PS/Xbox face labels, player slots, layout editing and saved arrangements, plus latency, status and the PC screen preview.
CONTROL CENTRE opens from the pad’s settings button. A compact header holds SETUP, ? and close actions; one six-tab row jumps to LINK, PAD, STYLE, LAYOUTS, SCREEN or DENSE, and each category remembers where you scrolled. On a wide window the cards sit in two columns; DENSE hides the longer notes when you want to see more at once. The sheet picks up the active theme’s gradient and accent glow, active tabs and theme swatches animate, and each palette has its own press ripple. The MOTION switch turns all of that off for players who prefer a still pad. Browser-only LAYOUTS and SCREEN stay; Android-only controls are not stubbed out.
This build serves the browser pad as plain LAN HTTP/WS on port 9878. The
Service Worker/offline Home Screen launch requires HTTPS and is therefore not
available in this plain build. iPhone can still add the pad to the Home Screen
and use that link while the PC is on.
Open it
- Start
lemoGamePad-server, orlemoGamePad-appif you use the desktop panel. - Look for the Web pad line in the console:
Web pad : http://192.168.1.20:9878/?k=AbCdEf12 - Open that URL on the device. Typing the URL works, and the server also draws
a scannable browser QR right in the console: point any phone camera at it
and the page opens. A
lemoGamePad-web-qr-<ip>.pngcopy is saved next to the server for printing or sharing.
The default port is TCP 9878 (the control port + 2). The k value is a
random pairing key generated for each run. Keep the full URL: without the key
the page and the WebSocket both answer 401.
Run the server on the PC that should receive the input, and make sure the device is on the same Wi-Fi. The phone does not need to reach the internet at all.
iPhone and Safari
There is no native iOS app: the Android APK cannot run on iOS, and the receiver still has to run on a Windows or Linux PC. An iPhone joins through this page in Safari, using the same local WebSocket as every other browser.
- iOS 13 or newer is recommended. It has Pointer Events, which the pad uses for multi-touch sticks, buttons, layout editing and the draggable preview. Older iOS versions get a touch-event fallback for the pad itself, but the preview cannot be dragged.
- Add to Home Screen. Tap Safari’s Share button, then Add to Home Screen.
The page declares
apple-mobile-web-app-capable, so it opens as a standalone pad without Safari’s bars. This is the iPhone replacement for FULL SCREEN, which iOS Safari does not allow (the setting shows N/A). - The pairing key is stable by default. A Home Screen icon keeps the
original URL, including
?k=. The receiver now creates and reuses~/lemoGamePad-web.keyon first run, so the saved shortcut keeps working after a restart. Use--web-key-file PATHor a fixed--web-keyonly when you want a different key. The page also caches the last valid key locally, so a shortcut saved without a query string can reconnect on its own. See Command-line options. - The Home Screen link uses the LAN IP. The receiver prints and QRs the
selected
http://PC-IP:9878/?k=...URL. Add that URL to Home Screen once; if DHCP gives the PC a new address, scan the new QR again. The key stays the same by default, so only the address changes. An open pad receives a COPY NEW LINK card when the receiver notices the move; a tab that already lost its socket needs the URL from the panel or console. - An in-app card shows the exact steps. Once the pad is open on iPhone, a short ADD TO HOME SCREEN card explains Safari’s Share → Add to Home Screen gesture. It can be dismissed with GOT IT (remembered) or LATER.
- Safe areas are respected. The pad canvas avoids the notch and the home indicator, and the screen preview is clamped inside the same safe area. Use landscape for larger controls.
- No gyro or tilt aim in the browser. Motion sensors are Android-app
features. iOS also requires
DeviceOrientationEvent.requestPermission()from a tap and a secure HTTPS context; this plain HTTP build does not offer that path. - Rumble becomes a sound cue on iOS. Safari has no Vibration API, so with SOUND CUE FALLBACK on (the default) a quiet tone follows the rumble strength instead. It only plays where vibration is unavailable, so Android browsers keep using the real motor. Turn it off in CONTROL CENTRE → CONTROLS if you want silence.
- Sleeping and waking. iOS can freeze the socket when the phone locks or the tab is backgrounded. The pad releases every button when hidden and reconnects automatically on wake (or when Wi-Fi returns); tap RECONNECT if the status still says CONNECTING. Keeping the tab in the foreground is still fastest.
- Keep the LAN URL. A public HTTPS page cannot open the server’s local
ws://socket, and this plain build has no HTTPS mode. Always use thehttp://address printed in the console.
Home Screen link (plain build)
The pad stays on screen when the link drops. A small pill at the top reports the link state and offers RECONNECT; it never covers the controls. Buttons keep their last released state, so a lost socket cannot leave a stuck input.
This plain build serves the browser pad over HTTP. The Service Worker/offline
Home Screen launch requires HTTPS and is therefore not available here. You can
still add the pad to the iPhone Home Screen; that shortcut opens the LAN page
while the PC is on. The default ~/lemoGamePad-web.key keeps the saved ?k=
link valid across server restarts; the printed LAN-IP URL is the only browser
pad link.
Wi-Fi setup QR
A phone must join the PC’s Wi-Fi before either pad QR can work. The console
receiver accepts --wifi-qr to print one extra QR for the active network; the
The native Rust desktop panel offers Wi-Fi setup / Save Wi-Fi QR in the
Pairing tab. Detection reads the current SSID and saved password with nmcli
on Linux or netsh wlan on Windows, without changing connections or prompting.
Reading a saved PSK can require local admin/polkit approval; if it is not
available the UI says so instead of guessing.
Scan the Wi-Fi QR first and approve the phone’s join prompt, then scan the app
or browser QR. A single QR cannot reliably join Wi-Fi and open a URL on stock
phone cameras. The Wi-Fi QR payload follows ZXing’s
WIFI:T:WPA;S=...;P=...;; format (or T:nopass for an open network), with
\, ;, ,, : and " escaped. It contains the plaintext password: the
console never echoes it, saved PNGs are owner-only on POSIX, and the GUI hides
it from the link field and clipboard. Enterprise Wi-Fi has no shareable key and
is skipped. Treat the saved image like a password.
The pad
The layout matches the Android app and supports multiple fingers at once. Move the left stick to L3, the right stick to R3, or roll a finger between face buttons without lifting it.
| Control | Touch | Keyboard |
|---|---|---|
| Left stick (L3) | drag the left circle | W A S D |
| Right stick (R3) | drag the right circle | I J K L |
| D-pad | tap or slide on the arrows | arrow keys |
| Triangle / Circle / Cross / Square | tap the face buttons | numpad 8 / 6 / 2 / 4 |
| L1 / R1 | tap the bumpers | Q / E |
| L2 / R2 | tap the triggers | 1 / 2 (or numpad 1) |
| Start | tap START |
Enter |
| Select | tap SELECT |
Shift |
| PS | tap PS |
` |
| L3 / R3 | tap the small L3 / R3 pills |
Z / C |
The status pill at the top shows the PC name, the assigned pad and the current round-trip time. Tap it to open the settings sheet. KEYBOARD MAP in the sheet shows the same list on the device.
Settings
Tap the status pill to open CONTROL CENTRE:
- Status — connected/offline state, assigned pad, latency graph with average/min/max/jitter, and CONNECT / RECONNECT / DISCONNECT.
- Connection — the server name,
--max-phoneslimit and PLAYER SLOT: AUTO (next free pad) or P1–P8. A free pad is assigned immediately; an occupied pad now sends the other player an Accept / Decline card instead of stealing it. The requester shows a pending chip and line until the answer arrives, then a short result toast. The game keeps running on both sides while the card is open, and the sheet shows which pad is actually in use. The number matches the controller the game sees, because the server creates every lower pad first; a move to an unused slot creates that pad too. P1 is the host seat and gets a LOCK PARTY button here. The first tab takes P1; if P1 swaps, the new P1 player becomes host. While the party is locked, other tabs cannot move or swap seats, but they keep sending input and a tab in AUTO can still take a free pad. The lock is released if the host leaves. - Appearance — the same ten themes as Android (Midnight Black, Cyberpunk, Arctic, AMOLED, Racing Red, Xbox, PlayStation, Minimal, Retro Arcade and Stealth), with a cross-fade when switching, PlayStation or Xbox face-button labels, an Animated buttons toggle and the FULL SCREEN toggle. AMOLED uses a true-black background so OLED panels can switch those pixels off; LCDs see no battery saving.
- Controls — stick deadzone, stick curve, vibration on/off, a separate Vibration from games switch, strength, and the input-rate mode.
- Layouts — customize the pad and save named arrangements (see below).
- PC screen — an in-page preview of the PC screen (see below).
Every theme also has its own one-shot press animation, drawn on the pad and
echoed by the settings buttons: Midnight waves, Cyberpunk shocks, Arctic
ripples, AMOLED snaps a single hairline void ring, Racing Red bursts, Xbox
halos, PlayStation waves, Minimal draws a line, Retro Arcade steps and Stealth
pulses. APPEARANCE → Animated buttons turns them off; it starts off when the
browser reports prefers-reduced-motion: reduce. Motion only advances while a
press is settling, so an idle pad still draws nothing.
Settings are stored in the browser’s localStorage on that device. They are
not shared with other browsers, other devices or the Android app.
Full screen
APPEARANCE → FULL SCREEN hides the browser bars and gives the pad the whole
display. The button follows the browser’s real state, so leaving full screen
with Esc or a system gesture updates it too. If the browser refuses the
request the label returns to OFF; where the Fullscreen API is missing
(notably iPhone Safari) it shows N/A. On iPhone, add the page to the Home
Screen to run it without browser bars.
Input rate
The browser has no background socket and cannot match the phone’s 250 Hz TURBO cadence, so the modes mean:
| Mode | Browser behaviour |
|---|---|
| ECO | Send only when something changes, plus a 1 s heartbeat. |
| STANDARD | Send only when something changes, plus a 250 ms heartbeat. |
| TURBO | Send continuously at roughly 60 Hz (one update per animation frame). |
TURBO is the lowest-latency choice on a fast local network; ECO is the lightest on battery. The server keeps the latest state either way, so a change is never waiting for the next heartbeat.
The ~60 Hz ceiling is on the browser side: JavaScript timers share the main thread, pointer events arrive at the display refresh rate, and background tabs are throttled. It is not a server limit — since 1.6.6 the server applies a browser frame within a millisecond or two of receiving it, and a phone can still stream at its full 250 Hz over UDP.
Layouts
The pad can be rearranged on the browser itself:
- Open settings → LAYOUTS → CUSTOMIZE (or SAVE AS / the edit bar).
- Drag a control to move it, pinch with two fingers to resize it, or hold it for about half a second to hide it. Hidden controls show as dashed placeholders while editing.
- DONE saves the current arrangement. RESET restores the built-in
positions. SHOW ALL brings every hidden control back. SAVE AS stores
a named copy; use DEFAULT in the layout list to return to the built-in
arrangement. SHARE CODE copies a
LMGB-LAYOUT-1text code; IMPORT CODE pastes one back in.
Editing while a named layout is active updates that saved entry in place. Saved
layouts are per-browser and stored in localStorage, never uploaded. They can
now be handed to the Android app as a QR (or pasted from one) and to another
browser via the share code or a #layout= link; those transfers are manual.
PC screen preview
Settings → PC SCREEN turns on a small live preview of the PC screen. Choose SMALL or LARGE, and LOW, BALANCED or HIGH stream quality. Drag the preview to move it, tap it to switch size, or press × to close it (re-enable it in settings). The preview is draggable and stays out of the way of the pad.
The preview reuses the same JPEG stream as the Android app and requires the
server’s screen stream (enabled by default; --no-video disables both). The
relay keeps only the newest frame, so a slow tab drops stale images instead of
building a delay. On a LAN, BALANCED is a good default; LOW uses less
bandwidth and HIGH is sharper. The live FPS and stream width appear as a
tooltip on the preview.
Rumble
The server forwards force feedback to the browser through the Vibration API when the browser exposes it. Android Chrome and most Android browsers support it; iOS Safari does not, so rumble is simply skipped there. Desktop browsers usually ignore it. Both motor levels are combined and sustained for as long as the game keeps rumbling; a zero level cancels it at once. The strength slider scales both game rumble and the small haptic tick when touching a control. Use Vibration from games to silence force feedback while keeping button clicks; it also silences the iOS sound-cue fallback.
Turning it on or off
| Flag | Effect |
|---|---|
| (default) | Browser pad enabled on control port + 2; key saved in ~/lemoGamePad-web.key. |
--web-port 8080 |
Use a different TCP port. |
--web-key mysecret |
Use a fixed pairing key instead of the saved one. |
--web-key-file PATH |
Use a different key file (stable Home Screen URL). |
--wifi-qr |
Also print a Wi-Fi setup QR for the PC’s active network (contains the password). |
--no-web |
Do not start the browser pad at all. |
--no-video |
Keep the pad but disable the PC screen stream (and preview). |
The first run on Windows adds an inbound firewall rule for the browser pad port,
the same way it does for the phone ports. If the rule is missing, the page will
not load; the console prints the exact netsh command to fix it. On Linux,
install-linux.sh opens TCP 9878 when ufw or firewalld is active.
Security
- The page and both WebSockets (
/wsfor control,/screenfor the preview) require the saved pairing key in the URL. They use plain LANhttp:///ws://. - WebSocket upgrades are rejected when the browser’s
Origindoes not match the page’s host, so a malicious website open in another tab cannot silently drive the pad or read the screen preview. - The page is served with a restrictive Content-Security-Policy and can only
load its own files. Static assets contain no secrets and load without the key
so that relative
<link>/<script>requests work; control still requires the key. - The screen relay connects only to the local video server on loopback. It cannot be pointed at another host.
- The server binds the normal LAN interfaces, like the phone protocol. Do not port-forward TCP 9878 (or UDP 9876 / TCP 9877) on your router. This is a LAN feature, not an internet service.
- The key is printed in the console, stored in the QR PNG and saved with
owner-only permissions in
~/lemoGamePad-web.key. Treat it like a password; delete that file (or pass a new--web-key) to rotate it.
See SECURITY.md for the full threat model.
Troubleshooting
| Symptom | Fix |
|---|---|
| Page does not load | Check the URL’s IP and port, confirm the device is on the same Wi-Fi, and allow TCP 9878 through the firewall. If the link stopped working after the PC joined a different network, the IP changed: the console prints Network changed with the new Web pad URL (and rewrites the QR images) within about ten seconds, so use that one or rescan the code. |
| Home Screen pad stopped after the PC moved networks | The saved URL still has the old IP. Scan the current web QR from the Pairing tab (or copy the Web pad URL printed in the console) and add that URL to Home Screen again. The key is stable by default; reserving a static DHCP IP keeps the address stable too. An open pad shows a COPY NEW LINK card when the server notices the move. |
Pairing link is not valid |
The saved key file was removed/changed, an explicit --web-key changed, or the ?k= part was dropped. Copy the current URL or rescan the web QR. |
| Page loads but the dot stays red | The WebSocket is blocked. Some guest / AP-isolation Wi-Fi networks block device-to-device traffic; use a normal network or USB tethering. |
| No controller appears | All --max-phones slots are busy. Disconnect an idle phone or raise the limit (maximum eight). |
| P1–P8 request is ignored | Another device already has that pad, and that player has not accepted the swap (or declined / did not answer within 10 s). The page stays on its current pad; a free requested slot is honoured in order, so P5 is the game’s fifth controller. If the host has locked the party, only the host can change seats until it unlocks or disconnects. |
| No Accept/Decline card appears | The card only appears for the player who owns the requested pad. Make sure their tab is connected and in the foreground; the PC resends the ask for 10 s, then reports a timeout to the requester. |
| Controls feel delayed | Prefer 5 GHz Wi-Fi and close background downloads. Try TURBO, and keep the tab in the foreground. |
| Theme or layout did not persist | Private/incognito windows may block localStorage; the session still works. |
| No vibration on iPhone | Safari has no Vibration API; the sound-cue fallback plays a quiet tone instead. On Android, check that the browser is allowed to vibrate. |
Home Screen shortcut shows 401 after a server restart |
The saved URL contains an old explicit ?k= or the default key file was deleted. The receiver now recreates and reuses ~/lemoGamePad-web.key; add the page to Home Screen again from the current QR. A shortcut created without a query string uses the browser’s cached key; clear site data if that key is stale. |
| Pad stays CONNECTING after the iPhone wakes | It reconnects on wake and when Wi-Fi returns; otherwise tap RECONNECT, or disable Auto-Lock while playing. |
| iPhone opens the pad in Safari instead of full screen | iOS Safari has no Fullscreen API. Add the page to the Home Screen; it then opens as a standalone pad. |
| No gyro aim on iPhone | Gyro is Android-app-only. iOS sensor access needs a secure context, but the browser pad never requests motion permission. |
| Home Screen icon will not open while the PC is off | This plain HTTP build has no Service Worker/offline Home Screen launch. The Home Screen link works while the PC is on; offline launch requires HTTPS and is not available in 2.2.12. |
| Preview or dragging misbehaves on an old iPhone | iOS 13+ is the supported floor. Older versions get a basic touch pad, but Pointer Events for preview dragging and iOS 13+ layout behaviour are not available. |
Preview says SCREEN OFF |
The server’s screen stream is disabled (--no-video), still starting, or unavailable on this platform. The rest of the pad keeps working. |
| Preview keeps retrying | Only a few viewers can share the stream; close other phones/tabs or restart the screen stream. |
| “waiting for controller…” in the console | The page connected but has not sent input yet; touch the pad or press a key. |
Not in the browser
The Android-only paths stay out of the page: Bluetooth HID gamepad, USB tethering, gyro aim and tilt steering require Android APIs or sensor permissions a browser does not expose here. Use the Android app for those. The browser also cannot create a virtual controller by itself — the PC server still does that.