Any program can drive physical input.
Start an HTTP server inside a script. Anything that can make a request — a web app, a Python process, an AI model — moves the mouse and presses keys. Permission-gated by the modeline.
-- rebind: min_sdk=3.0.0
-- rebind: name=HTTP Bridge
-- rebind: permission=net
Net.Listen(8080, function(req)
local cmd = JSON.Parse(req.body)
HID.Move(cmd.dx, cmd.dy)
if cmd.click then HID.Press("Mouse1", 20) end
return { status = 200, body = "ok" }
end)
Twenty-six namespaces. A real runtime, not a macro recorder.
| Namespace | What it does |
|---|---|
HID | Keyboard and mouse output — Down, Up, Press, Type, relative Move, Scroll, MoveTo |
Input | Live state — IsDown, GetDuration, GetActiveKeys, GetModifiers, GetMousePos |
Macro | Record, Play, Finish, StopAll — record and replay with hardware-accurate timing |
Screen | GetPixelColor(x, y) — sample any coordinate; SearchForColor — region scan |
Window | Find, move, resize, focus, set transparency, and kill windows — 17 methods |
Net | HTTP and WebSocket, client and server — Listen, WSListen, WSConnect, all HTTP verbs |
Audio | Play, Beep, SetMasterVolume — WAV, MP3, OGG, and FLAC playback |
Clipboard | Set and Get clipboard contents |
File | Sandboxed I/O — ReadJSON, WriteJSON, Append, Exists, MkDir, Copy |
Hash | MD5, SHA1, SHA256, SHA512, CRC32, HMAC |
Codec | Base64, Hex — encode and decode |
Regex | IsMatch, Find, FindAll, Replace, ReplaceAll, Split |
Pipe | Shared-memory IPC — Open(name).Read() for a Python or Node sidecar |
Dialog | Message, Confirm, OpenFile, SaveFile, OpenDir |
Timer | After and Every — schedule and repeat callbacks |
Math | Random, Gaussian, Scale, Spline, Resample, Interpolate |
UI | Declarative config panels — Schema, Toggle, Slider, Keybind, Select, Notify |
System | Time, Mouse, Screen, Window, Exec — environment and shell |
Env | Read environment variables; OS known-folder paths |
Registry | Windows registry read and write (Windows only) |
Config | ReadTOML and WriteTOML for persistent settings |
Bind | Declarative key binding — Bind(key, fn), Bind.Remap(from, to), Bind.Toggle |
Script | Exit, Reload — script self-management |
Log | Structured logging from inside scripts |
Process | Exists, List, Kill — OS process management |
JSON | Parse and Stringify |
Hooks, modelines, and concurrency.
Scripts respond to lifecycle and input hooks: OnStart(), OnStop(), OnFocus(window), OnBlur(window), OnTick(delta), OnDown(key), OnUp(key, duration), OnMove(dx, dy), OnScroll(delta), OnScrollH(delta).
Return false from a hook to swallow the event — the PC never sees it. Return true to pass through. Mouse-movement suppression requires hardware mode (mouse_block=true modeline).
Modelines declare script metadata: -- rebind: name=My Script, -- rebind: process=Photoshop.exe, -- rebind: window=Figma, -- rebind: tick_rate=8000, -- rebind: z_index=100, -- rebind: permission=net.
Concurrency is built in. Run(fn) launches a coroutine. Sleep(ms) pauses it. After(ms, fn) schedules a one-shot. Async(fn) wraps a Bind callback so it can Sleep. Task handles expose :Cancel(), :IsRunning(), and :Wait(). HID.Press and HID.Type run inside Run() or Async().
Drive Rebind from TypeScript.
A JSON-RPC WebSocket served at ws://127.0.0.1:19561. RPC p50 ~1 ms, p99 ~2 ms, ~10,000 req/s sustained.
// npm install @rebind.gg/client-ts
import { RebindRemote } from "@rebind.gg/client-ts";
const r = new RebindRemote("ws://127.0.0.1:19561");
await r.connect();
r.hidMove(30, -5);
r.hidPress("Mouse1", 20);
r.hidType("hello");
const { x, y } = await r.systemMouse();
const px = await r.screenPixel(x, y);
r.close();
Or Python.
# pip install git+https://github.com/usinput/rebind-client-py.git
from rebind import RebindRemote
with RebindRemote("ws://127.0.0.1:19561") as r:
r.hid_move(30, -5)
r.hid_press("Mouse1", hold_ms=20)
r.hid_type("hello")
x, y = r.system_mouse()
px = r.screen_pixel(x, y)
Or Rust.
use rebind_client::RebindClient;
let client = RebindClient::connect("ws://127.0.0.1:19561").await?;
client.hid_move(30, -5);
client.hid_press("Mouse1", 20);
Published, typed clients
- TypeScript —
npm install @rebind.gg/client-ts - Python —
pip install git+https://github.com/usinput/rebind-client-py.git - Rust —
cargo add rebind-client
What developers build
- Home and desk automation — bridge physical input to your smart-home or scripts over HTTP.
- AI-vision sidecars — a local model decides; the script moves real hardware via shared-memory
PipeIPC. - Robotics and control rigs — deterministic, scriptable HID output from a dedicated device.
- Automated testing — drive physical HID from your test suite for hardware-in-the-loop QA.