Skip to content

Development

locainin edited this page Jul 15, 2026 · 9 revisions

Development

Workspace layout

  • crates/unixnotis-daemon: D-Bus daemon and store.
  • crates/unixnotis-center: Control-center panel UI.
  • crates/unixnotis-popups: Popup UI.
  • crates/unixnotis-ui: Shared GTK/UI components and CSS loader.
  • crates/unixnotis-core: Shared models and configuration.
  • crates/unixnotis-installer: Installer, service-manager integration, trial mode, and reset flow.
  • crates/noticenterctl: CLI control tool.

Internal module layout

  • crates/unixnotis-center/src/dbus/: D-Bus backoff, command, seed, and type helpers.
  • crates/unixnotis-center/src/runtime/: application startup and coalesced config/CSS reload handling.
  • crates/unixnotis-center/src/ui/icons/: desktop icon indexing, resolution, missing-icon handling, and live icon updates.
  • crates/unixnotis-center/src/ui/init/: panel construction wiring, keyboard handling, search setup, timing, and startup actions.
  • crates/unixnotis-popups/src/app/: popup startup, reload coalescing, runtime glue, and startup tests.
  • crates/unixnotis-popups/src/dbus/: popup D-Bus connection, retry, seed, command, and type helpers.
  • crates/unixnotis-popups/src/ui/: entry, icon, stack reconciliation, state, and window geometry modules.
  • crates/unixnotis-installer/src/app/: installer UI flow, event handlers, state, and worker actions.
  • crates/unixnotis-installer/src/service_manager/: systemd, dinit, runit, and s6 backend contracts.
  • crates/unixnotis-installer/src/paths/: install root, binary path, and service backend discovery.
  • crates/unixnotis-installer/src/checks/: session, GTK, shell, and service-manager readiness checks.
  • crates/unixnotis-ui/src/css/: CSS loading, provider stacking, and watcher helpers.
  • crates/unixnotis-ui/src/icons/: shared desktop application icon indexing.
  • crates/unixnotis-core/src/model/: notification model helpers split into image, notification, and type modules.
  • crates/unixnotis-core/src/config/: config loading, versioned migrations, defaults, media settings, widget schemas, and runtime cleanup.
  • crates/unixnotis-core/src/config/layout/: panel and popup layout schemas.
  • crates/unixnotis-core/src/config/widgets/: slider, toggle, stat, card, and plugin schemas.
  • crates/unixnotis-core/src/config/runtime/sanitize/: runtime sanitize passes and focused sanitize tests.
  • crates/unixnotis-center/src/media/: MPRIS discovery, cache, event loop, metadata, policy, schedule, and snapshot handling.
  • crates/unixnotis-daemon/src/daemon/auth/: control-plane caller authorization and trusted binary checks.
  • crates/unixnotis-daemon/src/daemon/control/: panel control, DND, inhibitors, query, and clear-all helpers.
  • crates/unixnotis-daemon/src/daemon/notifications/: freedesktop notification payload, sender, and limit helpers.
  • crates/unixnotis-daemon/src/child_process/: center and popup child supervision.
  • crates/unixnotis-daemon/src/sound/: backend detection, sound-source resolution, and playback limits.
  • crates/unixnotis-daemon/src/trial_mode/: temporary takeover and restore of another notification daemon.
  • crates/noticenterctl/src/css_check/: active-theme validation, cache, lint, and geometry checks.
  • crates/noticenterctl/src/preset/: preset archive, export, import, inspect, and portability checks.
  • crates/unixnotis-installer/src/actions/: install, config backup/restore, environment sync, Hyprland, and build acceleration actions.

Build and test

cargo build --release
cargo test --workspace --all-targets --all-features
cargo clippy --all-targets --all-features -- \
  -D warnings \
  -W clippy::pedantic \
  -W clippy::nursery \
  -W clippy::undocumented_unsafe_blocks \
  -W clippy::multiple_unsafe_ops_per_block \
  -W clippy::mem_forget \
  -W clippy::cast_ptr_alignment \
  -W clippy::transmute_ptr_to_ptr \
  -W clippy::fn_to_numeric_cast_any \
  -W clippy::as_pointer_underscore \
  -W clippy::lossy_float_literal

Optional build acceleration

The installer can optionally write a local .cargo/config.toml that points to a wrapper script under .cargo/unixnotis-rustc-wrapper.sh. The wrapper uses sccache (compiler output caching) and mold (fast linker) when available, and falls back to plain rustc if either tool is missing.

Manual install on Arch:

sudo pacman -S sccache mold

Remove .cargo/config.toml and the wrapper script to disable build acceleration.

CSS validation

noticenterctl css-check

Clippy policy

The production lint profile uses -D warnings, clippy::pedantic, clippy::nursery, and selected restriction lints for unsafe-block documentation, pointer casts, forgotten values, and lossy literals. Clippy intentionally rejects enabling clippy::restriction as a blanket group because its lints represent mutually unsuitable policies. Keep the selected list in CI and the pull request template aligned rather than adding a blanket allow. Crates must not allow the complete pedantic or nursery groups. A named lint exception requires a reason and should live at the smallest practical boundary that preserves a stable public, wire-format, GTK, D-Bus, or installer contract. Long-lived compatibility exceptions use named expect entries with reasons. An expectation that no longer matches a real diagnostic fails under -D warnings, so stale exceptions cannot remain silent.

Test placement

Test functions live under a dedicated tests/ directory. A mod.rs file may route modules, but it must not contain test functions or fixtures. Prefer a descriptive test filename when one module is enough; split by behavior only when a test file becomes difficult to scan.

GTK tests that register an application must use a process-unique application ID. Reusing one fixed ID across parallel tests can intermittently fail with an already-exported D-Bus interface.

Logging

  • general.log_level in config.toml sets the default.
  • RUST_LOG overrides the configured log level when it is valid.
  • UNIXNOTIS_DIAGNOSTIC=1 enables capped diagnostic output.
  • Normal log snippets are capped; diagnostic mode raises the cap and still strips control/newline characters before logging.

Clone this wiki locally