Skip to content

Development & Contributing

Extraspace is a Rust 2021 Cargo workspace (MSRV 1.85+) paired with a Kotlin Android companion app under android/:

Crate Responsibility
xs-proto Wire protocol (control, video, camera, power), mirrored by Protocol.kt on Android
xs-mutter Virtual monitor, DisplayConfig layout persistence, and input injection over D-Bus
xs-video PipeWire capture → VA-API / software H.264 with zero-reorder SPS VUI rewrite
xs-transport USB (adb) & experimental LAN TCP transport, UDP discovery, framed sockets
xs-camera H.264 → /dev/video10 (VA-API or software decode)
xs-core Session orchestration, adaptive bitrate, RFI recovery, power/lock sync
xs-ui GTK4 / libadwaita front end, StatusNotifierItem system tray, live i18n

Design boundary: xs-mutter is the only crate that touches mutter’s private D-Bus APIs, confining any future GNOME upstream API changes to a single crate.

Everything above the tablet’s MediaCodec decoder and USB layer can be tested on one GNOME Wayland machine:

终端窗口
# 1. Pure unit tests (no hardware or GNOME required)
cargo test --workspace
# 2. Full host pipeline against a simulated tablet
cargo run -p xs-core --example fake_tablet
# 3. Capture & encode only (writes /tmp/extraspace-capture.h264)
cargo run -p xs-video --example capture_test
# 4. Mutter virtual monitor smoke test (creates a monitor for 5 seconds)
cargo run -p xs-mutter --example virtual_monitor

fake_tablet listens on 27183/27184/27185/27186, performs the handshake, consumes video frames, injects touch events, and reports decode health — exercising session orchestration, virtual monitor creation, capture, encoding, framing, touch injection, and adaptive bitrate probing end to end.

终端窗口
cd android
./gradlew assembleRelease

Once built, cargo run automatically discovers android/app/build/outputs/apk/release/app-release.apk and pushes it to the connected tablet.

Name Kind Description
EXTRASPACE_APK Env var Explicit path to extraspace.apk (overrides local Gradle output and system paths)
EXTRASPACE_FAKE_TABLET=1 Env var Connects to the local loopback fake_tablet stand-in
RUST_LOG Env var Controls tracing log filtering (e.g. RUST_LOG=debug)
--tray / --minimized CLI flag Starts hidden in the system tray

CI enforces all three checks (treating Clippy warnings as errors):

终端窗口
cargo fmt --all
cargo clippy --workspace --all-targets
cargo test --workspace
  • Comments explain why, not what — capture non-obvious platform quirks so nobody rediscovers them the hard way.
  • Prefer unit tests that catch regressions — keep controllers like adaptive bitrate pure and testable without hardware.
  • VA-API GPU encoding (vah264enc / vah264lpenc) and webcam decoding (vah264dec)
  • Virtual monitor layout & rotation persistence across reconnects
  • Bidirectional host/tablet lock & suspend power sync
  • System tray background mode & multi-language UI (EN / 简体中文 / 繁體中文 / 日本語)
  • Experimental Wi-Fi / LAN TCP fallback with UDP auto-discovery
  • Keyboard passthrough (NotifyKeyboardKeycode — the plumbing is already there)
  • Stylus with pressure, for tablets with an active pen
  • Audio to the tablet speakers
  • Tablet microphone as a PipeWire source
  • Camera controls: tap-to-focus, torch, zoom
  • Follow tablet rotation live

Licensed under GPL-3.0-or-later. Because the primary software encoder (x264) is GPL-licensed, licensing the project under GPLv3 keeps distribution obligations unambiguous.