Skip to content

Repository files navigation

D-pad Forwarder

Forward Meta Ray-Ban Display / Neural Band D-pad input to your computer.

You get:

  • A tiny glasses web app
  • A local WebSocket relay
  • A browser viewer for the event stream
  • An optional mouse controller

Tested on Linux. macOS and Windows mouse control are included as best-effort, but untested.

Requirements

  • Node.js 18+
  • Python 3, only if you want to generate QR codes
  • A public HTTPS tunnel for the glasses

Recommended tunnel:

cloudflared tunnel --url http://localhost:8787

ngrok works technically, but its browser warning page can block the glasses. Cloudflare Tunnel is smoother for this use case.

Quick Start

From this folder:

node server.js

Open the stream viewer on your computer:

http://localhost:8787/viewer.html

In another terminal, start a public tunnel:

cloudflared tunnel --url http://localhost:8787

Cloudflare prints a URL like:

https://example-words.trycloudflare.com

Use that URL as the glasses web app URL. When the glasses page says Live, D-pad events should appear in the viewer.

Generate A Glasses QR Code

Replace https://example-words.trycloudflare.com/ with your tunnel URL:

python3 scripts/qr_generator.py \
  --png dpad-forwarder-qr.png \
  'fb-viewapp://web_app_deep_link?appName=dpad-forwarder&appUrl=https%3A%2F%2Fexample-words.trycloudflare.com%2F'

Scan dpad-forwarder-qr.png.

Tip: the appUrl value must be URL-encoded. For a quick Cloudflare URL, replace:

https://example-words.trycloudflare.com/

with:

https%3A%2F%2Fexample-words.trycloudflare.com%2F

See The Stream

Open:

http://localhost:8787/viewer.html

Or use the tunnel version:

https://example-words.trycloudflare.com/viewer.html

The relay also prints every event as JSON in the terminal running node server.js.

Example event:

{
  "source": "glasses",
  "clientId": "glasses-abc123",
  "timestamp": 1779480000000,
  "type": "keydown",
  "key": "ArrowLeft",
  "repeat": false,
  "relayReceivedAt": 1779480000012,
  "relayClientRole": "glasses"
}

Control The Mouse

Start the relay first:

node server.js

Then run:

node mouse-controller.js

Controls:

  • D-pad arrows: move pointer
  • Enter / tap: left-click
  • Escape / Back: right-click
  • Stop button in the glasses app: disconnect sender

Tune movement speed:

MOUSE_STEP=35 node mouse-controller.js

Test without moving the pointer:

node mouse-controller.js --dry-run

Mouse Support By Platform

Linux: tested.

  • Wayland: uses ydotool when available
  • X11: falls back to xdotool

Install examples:

sudo apt install ydotool xdotool

macOS: untested.

  • Uses cliclick if installed

Install example:

brew install cliclick

Windows: untested.

  • Uses built-in PowerShell and user32.dll
  • No extra mouse package should be required

Force a driver:

MOUSE_DRIVER=ydotool node mouse-controller.js
MOUSE_DRIVER=xdotool node mouse-controller.js
MOUSE_DRIVER=cliclick node mouse-controller.js
MOUSE_DRIVER=powershell node mouse-controller.js

Desktop Testing

Open the sender locally:

http://localhost:8787/

Click Start, then use:

  • Arrow keys
  • Enter
  • Escape

You should see events in:

http://localhost:8787/viewer.html

Hosting Separately

Normally, serve the sender and relay from the same origin. Then the sender automatically connects to:

wss://same-host/ws?role=glasses

If the sender is hosted separately, pass the relay explicitly:

https://your-sender.example/?relay=wss%3A%2F%2Fyour-relay.example%2Fws%3Frole%3Dglasses

Troubleshooting

If the glasses say Live but the viewer is empty:

  • Open http://localhost:8787/viewer.html on your computer
  • Make sure node server.js is still running
  • Make sure the tunnel process is still running
  • Press D-pad arrows on the glasses after pressing Start

If the mouse controller only logs events:

  • It did not find a usable mouse driver
  • Run node mouse-controller.js --dry-run to confirm events arrive
  • Install ydotool or xdotool on Linux

If ngrok shows a warning:

  • Use Cloudflare Tunnel instead
  • The glasses may not be able to dismiss ngrok's interstitial

About

Forward Meta Ray-Ban Display D-pad input to a computer

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages