Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Platforms

Rebind runs on Windows, macOS, and Linux, and the same scripts move between them. The core runtime and the namespaces most scripts use — HID, remapping (Bind) and the input hooks, Macro/Timer/Math/Net/File/JSON/Regex/Config/Process/System.Exec, UI/Log/Input, and the Run/Sleep/After/Async globals — are identical on all three OSes. A few namespaces depend on OS-specific APIs and are limited or absent on some platforms. This page maps what runs where, and why.

Platform support

The table below lists every namespace with platform-specific behavior. Everything not in the table is fully cross-platform.

NamespaceWindowsmacOSLinux
ScreenFull (GDI)Full (CoreGraphics)Stub (Screen.List via display-info)
WindowFull (Win32)Enumeration + Kill/IsActive/WaitActive/WaitClose; rest best-effortStub
ClipboardFull (Win32)Full (arboard)Stub
PipeFull (shared memory)Not availableNot available
RegistryFull (Win32)Not availableNot available
DialogFull (native)Full (native)Requires Zenity/KDialog/YAD
System.Execcmd.exe /Csh -csh -c

The rest — Input, Macro, Timer, Math, JSON, Hash, Codec, Env, Log, File, Net, UI, Bind, Script, Regex, Config — is fully cross-platform. Software and hardware mode run the same scripts; neither changes this table — namespace availability is a property of the OS, not the transport. The one capability split between modes is mouse_block: suppressing or transforming mouse movement requires a Rebind device on every OS, because the cursor is drawn below anything a host process can intercept. Key, button, and scroll blocking work in both modes. For hardware setup, see Hardware.

  • Screen samples pixels on Windows (GDI BitBlt) and macOS (CoreGraphics / ScreenCaptureKit). On Linux pixel sampling is stubbed, not absent: Screen.GetPixelColor is still callable but returns a fixed "000000" (black) instead of a real pixel, and Screen.SearchForColor returns nil — neither raises an error. Only Screen.List (display enumeration) is real on Linux.
  • Window is full on Windows. On macOS, enumeration (Find, List) plus Kill, IsActive, WaitActive, and WaitClose are real. The manipulation calls split two ways: Move, Activate, Minimize, Maximize, Restore, and Close are silent no-ops — they return success and do nothing, so a pcall around them will not catch an error — while the Accessibility-gated calls SetTitle, SetAlwaysOnTop, SetTransparency, GetClass, Hide, and Show raise a “not supported on macOS without accessibility” error you can guard with pcall. Window.GetTitle returns an empty string on macOS; titles are only available via the title field on Window.List / Window.Find entries. On Linux, Window is a stub.
  • Pipe (shared-memory IPC) and Registry are Windows-only. They raise an error on macOS and Linux. POSIX shared-memory support for Pipe is planned.
  • Clipboard works on Windows and macOS; it is a stub on Linux.
  • Dialog is native on Windows and macOS; on Linux it needs Zenity, KDialog, or YAD installed.

If you target multiple platforms, guard the OS-specific calls. pcall catches the “not available” error a Windows-only namespace raises on macOS or Linux:

local ok = pcall(function()
  Registry.Write([[HKCU\Software\MyScript]], "REG_SZ", "Profile", "default")
end)
if not ok then
  -- portable fallback: persist to the script directory
  Config.WriteTOML("profile.toml", { profile = "default" })
end