Development & Contributing
Workspace Layout
Section titled “Workspace Layout”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-mutteris the only crate that touches mutter’s private D-Bus APIs, confining any future GNOME upstream API changes to a single crate.
Developing Without a Tablet
Section titled “Developing Without a Tablet”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 tabletcargo 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_monitorfake_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.
Building the Android Companion App
Section titled “Building the Android Companion App”cd android./gradlew assembleReleaseOnce built, cargo run automatically discovers android/app/build/outputs/apk/release/app-release.apk and pushes it to the connected tablet.
Environment Variables & CLI Flags
Section titled “Environment Variables & CLI Flags”| 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 |
Before Opening a PR
Section titled “Before Opening a PR”CI enforces all three checks (treating Clippy warnings as errors):
cargo fmt --allcargo clippy --workspace --all-targetscargo test --workspaceHouse Style
Section titled “House Style”- 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.
Roadmap
Section titled “Roadmap”- 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
License
Section titled “License”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.