Contributions are welcome. This document covers the development workflow, testing, and code quality requirements.
Install dependencies (see README.md), then:
git clone https://github.com/lamco-admin/xdg-desktop-portal-generic
cd xdg-desktop-portal-generic
git config core.hooksPath .githooks
cargo build
cargo testThe pre-commit hook runs formatting, clippy, and unit tests automatically.
This project uses strict clippy pedantic linting. The lint configuration lives
in Cargo.toml under [lints.clippy] -- this is the single source of truth
for lint levels.
rustup run nightly cargo fmtThe .rustfmt.toml uses nightly-only import ordering features
(imports_granularity, group_imports). Stable rustfmt will format everything
else correctly but skip import ordering.
cargo clippyKey rules:
clippy::pedanticis enforced at deny level#[allow(...)]is forbidden -- use#[expect(..., reason = "...")]instead- Every
#[expect]must include a reason string - Every
unsafeblock must have a// SAFETY: ...comment unsafe_codeis denied at crate level; modules with legitimate unsafe use#[expect(unsafe_code, reason = "...")]
cargo test # all tests
cargo test --lib # unit tests only (faster)Set XDG_DESKTOP_PORTAL_DIR to point to the data/ directory to test without
a system-wide install:
XDG_DESKTOP_PORTAL_DIR=./data/ \
RUST_LOG=xdg_desktop_portal_generic=debug \
cargo runUse the portal-test Flatpak app to exercise all portal interfaces interactively.
Monitor portal requests:
dbus-monitor --session "interface='org.freedesktop.impl.portal.ScreenCast'"Introspect the service:
busctl --user introspect org.freedesktop.impl.portal.desktop.generic /You can trigger portal methods directly with busctl:
# Check if the service is running
busctl --user status org.freedesktop.impl.portal.desktop.generic
# Read a setting
busctl --user call org.freedesktop.impl.portal.desktop.generic \
/org/freedesktop/portal/desktop \
org.freedesktop.impl.portal.Settings \
Read ss "org.freedesktop.appearance" "color-scheme"src/
dbus/ D-Bus interface implementations (ScreenCast, RemoteDesktop, etc.)
wayland/ Wayland protocol dispatch and state management
services/ Backend trait abstractions (capture, clipboard, input)
pipewire/ PipeWire stream creation and buffer management
session/ Session lifecycle and state machine
error.rs Error types
types.rs Shared data types
lib.rs Library root and PortalBackend orchestration
main.rs Binary entry point
data/
generic.portal Portal interface declaration
org.freedesktop.impl.portal.desktop.generic.service D-Bus activation service
xdg-desktop-portal-generic.service Systemd user service unit
Use conventional commits:
feat:new functionalityfix:bug fixrefactor:code restructuring without behavior changedocs:documentation onlytest:test additions or fixeschore:build, CI, or tooling changes
By contributing, you agree that your contributions will be licensed under the same terms as the project (MIT OR Apache-2.0).