Turn any Linux machine into a network display host — an open, native re-implementation of the spacedesk server for Linux.
spacedesk-linux streams this computer's screen over the local network to any
browser or phone (JPEG over WebSocket, plus a classic MJPEG endpoint), injects
the client's mouse/keyboard back into the desktop, and advertises itself on the
LAN with UDP discovery — so a client app can find the host automatically.
It ships two servers:
serve— its own open protocol with the bundled HTML viewer, andserve --compat— a re-implementation of the spacedesk protocol, so the official spacedesk viewer apps (Android / iOS / desktop / HTML5) can connect to a Linux host.
It is independent: no spacedesk code is reused. The protocol was reconstructed from a shipped spacedesk client — see docs/SPACEDESK-PROTOCOL.md.
The original product ships as a Windows MSI containing 8 kernel drivers and 4
user-mode binaries. A reverse-engineering pass over
spacedesk_driver_Win_11_64_v2233.msi (see docs/REVERSE-ENGINEERING.md)
recovered this architecture:
| spacedesk (Windows) | Role | spacedesk-linux equivalent |
|---|---|---|
spacedeskDriverBus.sys |
Virtual bus hosting child devices | — (not needed) |
spacedeskDisplayUmode*.dll (IddCx) |
Virtual monitor | evdi kernel module, or mirror / Xvfb |
spacedeskService.exe → SLIDxgiDuplication |
Screen capture (DXGI) | ffmpeg x11grab / PipeWire |
SETaskEncodeJpegCpu (libjpeg-turbo) |
JPEG encode | ffmpeg mjpeg |
SETaskEncodeMftH264 (Media Foundation) |
H.264 encode | ffmpeg libx264 (roadmap) |
L4/L5/L6 comm stack, TLS, WebSocket |
Transport | asyncio HTTP + WebSocket + MJPEG |
L4ThreadNetDiscovery (UDP) |
LAN discovery | UDP beacon/probe |
spacedeskKtmInput.sys, HID/mini drivers |
Input injection | Linux uinput / xdotool |
The Windows drivers are kernel-mode and cannot run on Linux — there is no "port". Everything they do has an open Linux equivalent, which is what this project assembles into one coherent server.
┌─────────────────────── spacedesk-linux host ────────────────────────┐
│ │
│ display ──► capture backend ──► JPEG frames ──► FrameHub │
│ (mirror / (ffmpeg x11grab / │ │
│ evdi / Xvfb) PipeWire / lavfi) │ │
│ ▼ │
│ uinput / xdotool ◄── input ┌────────────────────────────────┐ │
│ ▲ │ asyncio server (one TCP port) │ │
│ │ │ / viewer UI │ │
│ └── WebSocket text ──────┤ /stream.mjpg MJPEG │ │
│ (control channel) │ /ws WebSocket frames│ │
│ │ /api/info JSON status │ │
│ └────────────────────────────────┘ │
│ UDP 28253 ◄── discovery beacon/probe ──► clients │
└─────────────────────────────────────────────────────────────────────┘
│
any browser / phone / VLC / ffplay ──► extra screen
Everything is pure Python standard library at runtime; the only external
program it needs is ffmpeg (and optionally gst-launch-1.0 for Wayland).
- Zero Python dependencies — stdlib only (3.9+).
- Two client transports on one port: WebSocket (low latency, with a control
channel) and multipart MJPEG (
/stream.mjpg, works in<img>, VLC, ffplay). - Bundled browser viewer — canvas rendering, fullscreen, live FPS/bitrate.
- Remote input — mouse, wheel, keyboard and touch, via
uinput(Wayland + X11), falling back toxdotool/ydotool. - UDP discovery —
spacedesk-linux discoverfinds hosts on the LAN. - Several capture backends — X11/XWayland, PipeWire (Wayland portal), V4L2, a media file, or a synthetic test pattern.
- Several display modes — mirror, evdi virtual monitor, Xvfb headless, or fully headless.
- Optional shared-secret token,
--nameadvertising, systemd units and a.debbuilder.
- Linux with Python ≥ 3.9
ffmpeg(sudo apt install ffmpeg)- For a true extra monitor: the
evdikernel module (sudo apt install evdi-dkms && sudo modprobe evdi) - For Wayland full-desktop capture:
gstreamer1.0-tools+gstreamer1.0-pipewire(xdg-desktop-portal screen cast) - For remote input via uinput: read/write access to
/dev/uinput(usually by joining theinputgroup:sudo usermod -aG input $USER)
git clone <this repo> && cd spacedesk-linux
./scripts/install.sh # per-user, installs to ~/.local
# or
sudo ./scripts/install.sh --system # system-wide, /usr/localpip install . # or: pipx install ../packaging/deb/build-deb.sh
sudo apt install ./dist/spacedesk-linux_*_all.deb./packaging/appimage/build-appimage.sh # bundles CPython + ffmpeg
./dist/spacedesk-linux-0.1.0-x86_64.AppImage doctorThe AppImage is a single self-contained file you can copy to any x86-64 Linux
box, chmod +x, and run — nothing to install. Use --slim to skip the bundled
ffmpeg (smaller; falls back to the system one).
spacedesk-linux doctor # check what your machine can do
spacedesk-linux serve # mirror the desktop on :28252Then open http://<host-ip>:28252/ on your phone or another computer.
spacedesk-linux discover # find hosts from another machinespacedesk-linux serve --compat # speaks the spacedesk protocol on 28252Then in the spacedesk viewer app, add/connect to this machine's IP on port
28252 (manual IP entry). The server also accepts the official HTML5 viewer
from http://viewer.spacedesk.net/. Video is JPEG, and the app's mouse/touch/
keyboard are injected into the Linux desktop.
Both WebSocket and raw TCP are accepted on the same port, so the Android/iOS, desktop and HTML5 viewers all work.
Compatibility is based on the protocol reconstructed from the shipped spacedesk client; see docs/SPACEDESK-PROTOCOL.md for the full specification and the list of what is / isn't implemented.
spacedesk-linux <command> [options]
commands:
serve run the streaming server
discover find spacedesk-linux hosts on the LAN
doctor print a capability / environment report
| Option | Default | Meaning |
|---|---|---|
--host |
0.0.0.0 |
Bind address |
--port |
28252 |
TCP port (viewer, MJPEG, WebSocket) |
--mode |
mirror |
mirror · virtual · x11 · xvfb · headless |
--backend |
x11 |
x11 · lavfi · v4l2 · file · pipewire |
--width / --height |
1280×720 |
Capture resolution |
--fps |
15 |
Target frame rate |
--quality |
5 |
JPEG quality (2 best … 31 smallest) |
--display |
auto | X11 display to capture, e.g. :0 |
--device |
/dev/video0 |
V4L2 device |
--input-file |
— | Path for --backend file |
--token |
— | Shared secret required by clients (own viewer mode) |
--compat |
off | Serve the official spacedesk protocol instead (for the real apps) |
--no-input |
off | Disable remote input |
--no-discovery / --discovery-port |
on / 28253 |
UDP discovery |
--name |
hostname | Advertised name |
-v |
off | Verbose logging |
| Mode | What it does | When to use |
|---|---|---|
mirror |
Streams the existing primary display | Simplest; always works |
virtual |
Attaches a real virtual monitor via evdi (falls back to mirror) | You want a separate extra screen |
x11 |
Like mirror but resolves geometry explicitly from X11 | Fine-grained control |
xvfb |
Spawns a headless Xvfb screen and streams that | Servers, CI, testing |
headless |
No display setup at all | Used with --backend lavfi/v4l2 |
| Backend | Source |
|---|---|
x11 |
X11 / XWayland screen grab |
pipewire |
Wayland screen cast via xdg-desktop-portal |
v4l2 |
A capture device (HDMI grabber, webcam) |
file |
Loop an image/video (kiosk signage) |
lavfi |
Synthetic test pattern (testsrc2) |
# any browser
xdg-open http://<host-ip>:28252/
# VLC / mpv / ffplay / most MJPEG-aware apps
vlc http://<host-ip>:28252/stream.mjpg
ffplay -f mjpeg http://<host-ip>:28252/stream.mjpg
mpv http://<host-ip>:28252/stream.mjpg--mode virtual looks for the evdi kernel module, the same mechanism
DisplayLink uses to create virtual displays:
sudo apt install evdi-dkms # Ubuntu/Debian
sudo modprobe evdi
spacedesk-linux serve --mode virtualWithout evdi, --mode mirror still gives you the whole desktop on the client —
it just duplicates your primary screen instead of adding a new one.
Under a Wayland compositor, X11 grab only sees XWayland windows. For the whole desktop use the portal screencast backend:
spacedesk-linux serve --backend pipewireuinput is the preferred backend and works on both X11 and Wayland:
sudo usermod -aG input "$USER" # then log out/inEnable the viewer's remote input toggle and the client's mouse/keyboard/touch drive the host. If no backend is available the server logs a warning and stays read-only — video never breaks.
# per-user (recommended: inherits your session's DISPLAY/WAYLAND_DISPLAY)
systemctl --user daemon-reload
systemctl --user enable --now spacedesk-linux
# system-wide (edit DISPLAY= in the unit for your session)
sudo systemctl enable --now spacedesk-linux- The server is unauthenticated by default. Use
--token <secret>and openhttp://host:28252/?t=<secret>to require it, and/or restrict with a firewall. - Streams are plaintext HTTP/WebSocket. For untrusted networks, tunnel it (e.g. WireGuard, SSH port-forward, or a TLS reverse proxy). Native TLS is on the roadmap.
- Remote input injects real events into your desktop — only enable it on trusted networks.
sudo ufw allow 28252/tcp # viewer / MJPEG / WebSocket
sudo ufw allow 28253/udp # discovery| spacedesk (Windows) | spacedesk-linux | |
|---|---|---|
| Virtual monitor | IddCx kernel driver | evdi (or mirror/Xvfb) |
| Clients | official Android/iOS/Windows/HTML5 apps | works with the official apps (--compat) and any browser |
| Protocol compat | — | ✅ official spacedesk protocol (reconstructed) |
| Video codec | JPEG + H.264 | JPEG (H.264 planned) |
| Audio | virtual audio device | ✗ (planned) |
| Camera passthrough | virtual camera driver | ✗ (planned) |
| USB cable mode | AOAP driver | ✗ (LAN only) |
| Dependencies | proprietary driver | Python stdlib + ffmpeg |
- Mirror + Xvfb + discovery + WebSocket/MJPEG + input
- Official spacedesk protocol compatibility (
serve --compat) - H.264 / fragment-MP4 or WebRTC transport (lower bandwidth)
- TLS (self-signed cert generation, like spacedesk's
.pfx) - Dirty-region encoding (send only changed tiles)
- Multi-monitor selection & per-client virtual monitors via evdi
- Audio streaming (PulseAudio/PipeWire)
- Native phone apps (the browser viewer already works on Android/iOS)
python3 tests/run_tests.py # zero-dependency test runner
pip install -e '.[dev]' && pytest # or use pytest if you have itLayout:
src/spacedesk_linux/
cli.py command line entry point
server.py asyncio HTTP/WebSocket/MJPEG server + FrameHub
compat.py official spacedesk-protocol server (WebSocket + raw TCP)
protocol.py spacedesk wire protocol (packets, headers, enums)
capture.py ffmpeg / PipeWire capture backends (JPEG carving)
websocket.py dependency-free RFC 6455 server
discovery.py UDP LAN discovery
input_inject.py uinput / xdotool / ydotool input backends
virtual_display.py evdi / Xvfb / xrandr display handling
platform_detect.py environment probing
web/ bundled browser viewer
tests/ unit tests + run_tests.py
packaging/ systemd units, .deb builder, AppImage builder
scripts/ install / uninstall
docs/ protocol + reverse-engineering notes
MIT. See LICENSE. "spacedesk" is a trademark of its owner and is used here only descriptively; this project is independent and unaffiliated.