Skip to content

ritovision/mobypaste

Repository files navigation

MobyPaste

MobyPaste

Tiny local server for using a mobile browser as a text entry surface and pasting the submitted text into the currently active Windows app.

Setup

Run these from this project folder in PowerShell or Command Prompt:

py -3 -m venv .venv
.venv\Scripts\activate
python -m pip install -r requirements.txt
python app.py

The server defaults to port 7777 and prints a tokenized phone URL like:

http://192.168.0.24:7777/?token=...

Open that URL on the Pixel 7 while the phone and PC are on the same Wi-Fi. The startup terminal also prints a scannable QR code for the same URL.

Desktop Launchers

Double-clickable launcher files are included:

  • allow-mobypaste-firewall.bat allows TCP port 7777 through Windows Firewall for private networks.
  • start-mobypaste.bat starts the server from this project folder.
  • stop-mobypaste.bat kills matching Python server instances and Python listeners on port 7777.
  • moby-on.bat runs mp on.
  • moby-off.bat runs mp off.

The batch files resolve the project folder from their own location. For Desktop access, create shortcuts to these repo files instead of copying them. If you really need to launch copied scripts from somewhere else, set MOBILE_PASTE_BRIDGE_PROJECT_DIR to the repo folder.

Terminal Command

mp.bat wraps the launchers:

mp on
mp off

From this project folder, run it as .\mp on or .\mp off in PowerShell. To use mp on and mp off from any folder, add this project folder to your Windows user PATH, then open a new terminal.

If CMD cannot find mp, run it once from the project folder as .\mp on, or double-click moby-on.bat.

Use

  1. Start the server.
  2. Open the printed phone URL on Android.
  3. Click the target text field or app on Windows.
  4. Type or dictate into the phone textarea with your mobile device.
  5. Tap Paste to PC or Paste + Enter.

The paste goes wherever Windows focus currently is. If the wrong app is focused, the text will paste there.

Project Files

  • app.py runs the server and Windows paste automation.
  • index.html contains the mobile page markup and client-side JavaScript.
  • mp.bat provides the mp on / mp off terminal command.
  • mp.cmd mirrors mp.bat for Windows command resolution.
  • styles.css contains the mobile page styling.

Configuration

Optional .env values:

MOBILE_PASTE_BRIDGE_PORT=7777
MOBILE_PASTE_BRIDGE_TOKEN=change-this-token
MOBILE_PASTE_BRIDGE_CLIPBOARD_DELAY=0.15
MOBILE_PASTE_BRIDGE_ENTER_DELAY=0.15
MOBILE_PASTE_BRIDGE_MAX_CHARS=50000
MOBILE_PASTE_BRIDGE_QR_BORDER=2
MOBILE_PASTE_BRIDGE_PUBLIC_HOST=

If no token is configured, a new one is generated and printed on startup. If MOBILE_PASTE_BRIDGE_PUBLIC_HOST is empty, the app auto-detects the LAN IP. Set it only when you want to force the printed phone URL/QR to use a specific hostname or IP.

Troubleshooting

If mp is not recognized, open a new CMD/PowerShell window so Windows reloads your PATH. From the project folder you can always run:

.\mp on
.\mp off

If the QR opens on the phone but paste does not happen, check the server terminal or .runtime.log. A healthy phone page load logs Phone connected from ..., and a healthy paste logs Pasted ... characters from ....

If there is no Phone connected line, the request is not reaching the PC. On a new Wi-Fi network:

  • Restart MobyPaste and scan the fresh QR, because the PC LAN IP may have changed.
  • Run allow-mobypaste-firewall.bat as administrator to allow inbound TCP port 7777 on private networks.
  • Make sure the phone is on the same normal Wi-Fi network as the PC, not a guest network or client-isolated network.

If Phone connected appears but paste still does not land, click the target Windows app first. A non-admin MobyPaste process may also fail to paste into an app running as administrator.

Notes

  • Do not expose this server to the public internet.
  • Windows Firewall may ask for permission the first time.
  • Run with Windows Python, not WSL Python. WSL cannot reliably automate normal Windows desktop apps.
  • A non-admin server may not paste into an app running as administrator.
  • The Windows clipboard is overwritten by design.

License

MIT. See LICENSE.

About

Mobile-to-desktop typing bridge

Resources

License

Stars

Watchers

Forks

Contributors