Read the Weld specifications for project intent and future direction. Their status labels distinguish verified behavior from agreed constraints and exploratory ideas; only Implemented material describes the repository as it exists.
Before the first stable release, prioritize architectural coherence over changeset size. Sweeping, cross-cutting refactors are acceptable when they establish or correct ownership, module, API, and lifecycle boundaries. When concrete responsibilities are already distinct, separate them before temporary coupling becomes the project structure. Add crates only for real dependency, runtime, reuse, or testing boundaries, and do not create empty modules or placeholder crates for future milestones. The current crate responsibilities and dependency direction are recorded in Architecture.
For Bevy-related work, read the relevant project skill first:
- bevy-020 for the Bevy 0.20 migration and Weld's integration boundaries. Check the manifests for the currently built version before applying version-specific guidance.
- bevy-bsn-ui for BSN scenes and reusable UI composition.
For compositor-host work, read smithay before changing protocol dispatch, event-loop integration, backends, rendering, Smithay features, vendored source, or local upstream patches.
Tracked architecture evidence belongs under docs/; agent workflows and
reusable implementation guidance belong under .agents/skills/.
Read Architecture before changing subsystem ownership
or lifecycle boundaries.
The root Cargo.toml is a virtual workspace. apps/weldwm owns the standard
compositor application, its integration tests, benchmarks and Rust examples.
It is the sole default-members entry, with default-run = "weldwm", so plain
cargo build, cargo run, and cargo test from the repository root continue to
select that application. Shared profiles, patches, the lockfile and build output
remain at the root. Example configuration paths still start at examples/.
Declare reusable Weld crate paths in [workspace.dependencies], then inherit
with workspace = true. Keep consumer-specific features and optional = true
in the consuming manifest. The standalone Connect, Mobile, VR and video-GLES
workspaces retain their own dependency declarations.
Repository Python tools use the root pyproject.toml and uv.lock.
Run uv sync --locked once, then uv run <command> from the shared development
shell. Entry points bind directly to Typer applications. One FANCY_OUTPUT
setting in tools/dev/cli.py controls help, colors and tracebacks;
plain output is the default. See Development tools
for commands, tests and the cleanup inventory.
uv run check-host-runtime is a bounded real-Wayland regression runner
(Python 3, supplied by the development shell). Use --shm-only to exercise
hosting without Vulkan, or --nested to check native screenshot capture with
foot on an existing desktop. The default protocol fixture installs an explicit
test presentation consumer. --stalled-presenter --shm-only verifies it can
progress even when a fake native display never completes a frame;
--dormant --shm-only checks the production headless host without any viewer.
--reclaim-presenter --shm-only checks that returning callback ownership
restarts local composition without another client commit or UI redraw.
--policy-only --shm-only also checks non-Bevy
policy servicing with no presenter or rendering. Python provides process-group ownership
and bounded waits for these subprocess tests. Logs remain in target/validation.
Add --frame-timings to a protocol-probe run to distinguish frame-callback
delay from SHM buffer-release delay; this is not an encoder or GPU latency test.
Use debug-profile commands during normal development. Run the narrowest useful check first, then widen as the change warrants:
cargo fmt --check
uv run check-desktop-build-graph
cargo check-desktop
cargo test-desktop <test-name>
cargo clippy-desktop -- -D warnings
Desktop executables and tests link Rust code statically and share the standard
dependency graph. Debug builds use optimization level 1 and full debug symbols
for workspace code, and optimization level 3 with debug symbols disabled for
third-party dependencies. Tests inherit these development settings. The perf
profile retains optimized code and full dependency symbols for profiling.
Run binaries in the shared development shell so native graphics and media
libraries remain available.
All workspace crates that use Bevy inherit one exact version and feature set from the root workspace dependency. Keep that set centralized: crate-local feature additions make package-specific Cargo commands build another Bevy artifact instead of reusing the distribution's prebuilt Bevy artifacts.
Include -p weldwm when selecting desktop leaf-crate tests, for example
cargo test -p weldwm -p weld-input --test bindings. The full application also
unifies features through transitive dependencies such as Leafwing. Keeping that
package selected preserves the application feature graph while running the
requested test target. Apply the same package selection to checks and example
builds. Build a leaf example with cargo build -p weldwm -p weld-core --example NAME,
then execute target/debug/examples/NAME in the development shell.
The standard distribution enables test-support in its default feature set so
ordinary builds, tests and benchmarks compile the same library variants.
Benchmark presentation is installed explicitly by fixture constructors; ordinary
application construction leaves that callback unset. Select tests by package,
target and name while retaining these defaults. Routine desktop work must keep
the same features: avoid --all-features, --no-default-features, and ad-hoc
feature additions. test-desktop, check-desktop and clippy-desktop select the
desktop workspace together and exclude weld-media-android, whose media feature
set belongs to the Android assembly.
uv run check-desktop-build-graph compares shared resolved dependency features
for ordinary builds, focused tests/examples and the desktop aliases using Cargo
tree. It requires cached dependencies and performs no compilation. Run it after
manifest or workflow changes. Test harnesses and cfg(test) still produce their
own binaries; debug, release and profiling profiles keep separate artifacts.
Use the same development environment and target directory across ordinary runs
and tests. Leave compiler flags in .cargo/config.toml; avoid one-off RUSTFLAGS,
profile overrides or CARGO_TARGET_DIR changes for routine desktop work.
Explicit Tracy/perf investigations and Android/client assemblies retain their
documented feature, compiler and target settings as separate build variants.
Weld Station uses uv run run-connect for its standalone client assembly.
Use --test, --check, or --clippy for opt-in validation with the launcher's
same environment, default features and development profile. Android supports
--android --check and --android --clippy; tests execute on Linux. Keep all
commands in the same development shell. Both platforms share the cache root
target/dioxus-texture-probe/cargo, with separate target-specific artifacts.
Cargo uses Clang and LLD for Linux targets. The shared Rust shell already provides both tools, so run builds from that environment rather than depending on globally installed linkers.
Bevy system-font discovery requires Fontconfig development metadata while
building and libfontconfig at runtime. The shared Rust shell provides both;
other environments must make Fontconfig available to pkg-config and the
runtime loader.
Sway font configuration uses Pango's font-description parser. weldwm requires Pango 1.56 or newer development/runtime libraries and their GLib dependencies; the shared Rust shell already supplies them. Parsed typography is published to the decoration settings, and Bevy resolves the selected installed font.
DRM monitor identification uses libdisplay-info through Smithay's EDID helper.
The current Rust bindings require the native library below 0.4; the shared
Rust Nix shell supplies libdisplay-info_0_3. Reload that shell after adding
this dependency so its headers, pkg-config metadata and runtime library are available.
Application audio requires PipeWire development/runtime libraries (libpipewire-0.3
and libspa-0.2 pkg-config metadata). The shared Rust shell supplies both.
PipeWire and WirePlumber must be running for the opt-in audio integration tests;
those tests use private outputs and silent routing probes. See Application audio.
Hardware media work requires FFmpeg development/runtime libraries, libva
development/runtime libraries (libva package 2.23 or newer), libva-utils, Clang,
and bindgen. weld-vaapi generates its private ABI from those system headers. In
particular, libavcodec, libavfilter, libavformat, and libavutil must be
visible to pkg-config; they are required by ordinary workspace checks because
the standard distribution includes encoded hoisting. On NixOS, the shared Rust
shell provides those libraries and points libva at the active system driver
directory under /run/opengl-driver/lib/dri; it deliberately does not force a
vendor driver name. A missing FFmpeg or libva environment must be reported
separately from a loaded driver that lacks a requested capability.
uv run build-mobile builds Rust through cargo-ndk and packages the Android
activity and Google Code Scanner with a pinned Gradle wrapper. Its first build
downloads Gradle and Maven dependencies; later builds reuse their caches.
Android Studio is unnecessary. The Android SDK/NDK and Java paths come from the
development shell. Pairing validation is described in Phone pairing.
Run Weld inside a development shell whose glibc is compatible with the running
NixOS graphics drivers. The shared Rust shell is located at
/home/jonas/Dotfiles/nixos/envs/rust; reload it after its lock file changes.
From a graphical terminal, cargo run automatically selects a nested host and
finds configuration in this order: --config, WELD_CONFIG, the XDG Weld config
($XDG_CONFIG_HOME/weld/config or ~/.config/weld/config, then
$XDG_CONFIG_DIRS/weld/config, defaulting to /etc/xdg/weld/config), and
examples/master.sway.config in the working directory. Missing explicit files
and invalid selected files fail instead of silently falling back. On a bare TTY,
automatic backend selection uses DRM.
Nested graphical launches default to weld-nested-PID; DRM and headless hosts
keep weld-0. The selected name is shared by Wayland, controls and launched
clients and is printed at startup. Use --wayland-socket NAME for a stable test
session; an occupied explicit name is an error.
Launch Weld's nested development host without a client:
cargo run -- --backend nested --config examples/master.sway.config
Backend selection defaults to auto. Use an explicit backend when validating
host-specific behavior so the environment cannot change the target silently.
--backend headless runs the presentation-free Wayland session host with
configurable virtual outputs. auto never selects it. See
Headless application hosting for the host contract;
the old multi-application demo launchers have been retired.
Pass a program and arguments to launch it against Weld's private Wayland socket. The verified smoke test uses foot:
cargo run -- --backend nested --config examples/master.sway.config -- foot
To open another application in an already-running Weld instance, use the native control command from a second shell:
weldctl --session weld-0 launch -- foot
This uses the session's current Wayland/XWayland and cursor configuration.
--cwd PATH selects the application's working directory; by default it inherits
the calling shell's directory. See Native launch for
validation and process-versus-window readiness.
For X11 clients, enable --xwayland and launch through Weld (CLI, config exec,
or a terminal inside Weld), which supplies the session's private DISPLAY.
See Rootless XWayland for validation commands and limits.
The development example config provides these backend-neutral shortcuts:
Alt+Enter: launch footAlt+Space: launch Rofi (drun)Alt+Control+Shift+F: launch FirefoxAlt+Shift+B: launch BlenderAlt+B: cycle the selected window's titlebar/border styleAlt+H: hoist or locally preview the focused occupied windowAlt+Shift+I: toggle persistence and show the captured replacement ruleAlt+D/F/K/JorAlt+Arrow: focus left/right/up/down- Add
Shiftto navigate a tile structurally through neighboring splits Alt+Control+Arrow: adjust tile proportionsAlt+Control+F/J: prepare a horizontal/vertical splitAlt+Shift+R: reload weldwm configurationAlt+Shift+Q: request close of the focused clientAlt+Shift+O: toggle output-topology diagnosticsAlt+Shift+Escape: exit Weld
These example bindings live in examples/master.sway.config, not the reusable plugins.
That file configures Ctrl/Caps and left Alt/Windows swaps: logical Alt is the
physical Windows key with those settings. weldwm reads explicit Weld input
configuration in both nested and DRM modes.
The example starts Waybar through exec, using the repository's example config
and style paths. Launch from the repository root, or adjust those paths in your
own configuration. Its workspace buttons use ext-workspace-v1.
weldwm uses the native tiler. The typed configuration pipeline
and its generator are maintained independently of runtime policy. Its Sway configuration subset and
reload semantics are documented in weldwm tiling.
Weld options precede an explicit -- when a client is also present. Capture a
settled client-plus-shell composition and exit with:
cargo run -- --config examples/master.sway.config --screenshot target/weld-startup.png -- foot
Enable the restricted, loopback-only development protocol with:
cargo run -- --config examples/master.sway.config --remote-debug -- foot
uv run weld-debug status
uv run weld-debug screenshot target/weld-remote.png
Read REMOTE_DEBUGGING.md before changing the protocol, capture completion, or exposed Bevy methods.
The maintained paced compositor benchmark runs through uv run paced-render.
It uses private headless presenters and records bounded measurement artifacts.
Historical profiling scenario runners have been retired; their dated evidence
remains under docs/performance/.
Run a native DRM development session from a real TTY with
cargo run -- --backend drm --config examples/master.sway.config. The old
run-weld-drm wrapper and Smithay example launcher have been retired.
For dependency changes, edit only the intended dependency. If an existing
lockfile entry must move, use cargo update -p <package> --precise <version>;
never update the entire lockfile casually.
uv run check-screenshot-capture validates Grim output/region capture and PNG
clipboard delivery in a private nested session. See Screenshots
for the asynchronous GPU snapshot regression and manual DRM checks.
uv run check-output-capture validates DMA-BUF/SHM pixel equality, repeated
capture, cursor inclusion and cancellation. It defaults to a GPU-backed headless
Weston parent so tests do not open windows on the running Weld desktop. Set
WELD_TEST_WESTON when Weston is not on PATH. A visible fallback is permitted on
other identified desktops; --visible explicitly permits it on Weld. Optional
--portal, --kooha, --kooha-region, and --kooha-window checks use a private D-Bus session
and portal services;
their dependencies and environment are documented in Screenshots.
Add coverage when it validates a stable behavior, protects a contract, or reproduces a regression. Prefer deterministic ECS and policy tests over tests that require a display server or GPU. Use a nested or headless host for broader integration tests once one exists.
Test Weld-owned business logic and the contracts at integration boundaries. Do not add tests that reassert Smithay behavior, or tests whose implementation is mostly a thin call through Smithay APIs. Validate those dependencies through focused integration probes on real hardware when needed, and keep unit tests for policy, translation, lifecycle, and invariants that Weld itself owns.
Keep exploratory coverage proportional. Avoid broad suites around provisional wiring before its behavior has settled.
- Handle fallibility without
panic!,unreachable!, or.unwrap()in production paths. - Prefer
if letand let chains over deeply nested matching when they improve clarity. - Avoid unsafe code. When it is unavoidable, document each unsafe block with a
SAFETYcomment that states the upheld invariant. - Prefer
#[expect(...)]with a reason over#[allow(...)]for necessary lint exceptions. - Do not suppress structural lints such as excessive function arguments by
default. Prefer correcting the ownership boundary or introducing a cohesive
context type; when an exception is genuinely clearer, document the concrete
reason on the narrowest
#[expect(...)]. - Keep imports at module scope and use descriptive names rather than abbreviations.
- When every variant of an enum carries the same field, extract that field into an enclosing struct and keep only variant-specific data in the enum.
- Link Rust types as [
TypeName] in doc comments when rustdoc can resolve them.
Document non-obvious ownership, ordering, lifetime, protocol, and thread boundaries close to the implementation. Significant modules should explain their purpose and normal consumer, but ordinary accessors and direct control flow do not need narration.
Write comments in positive, concrete terms: explain purpose, behavior, invariants and the reason for a decision. Avoid boilerplate about what something "isn't" or lists of systems it does not depend on. Keep architectural comparisons and scope discussions in the relevant design documentation.
Make an atomic commit after each coherent batch. Use a short subject line and omit the body unless it adds essential context. Never add generated-by or co-author attribution trailers.