runlatch-core
The data model, provider abstraction, built-in providers, and registry that power runlatch, a modular Linux autostart manager.
Linux autostart is spread across systemd units, XDG .desktop files, and DE-specific
session configs. This crate unifies them behind one trait, AutostartProvider, aggregated
by a Registry. New backends (OpenRC, KDE, GNOME, …) are added by implementing the trait —
no changes to the core.
Quick start
Enumerate every autostart entry on the machine across all built-in providers:
use Registry;
# async
The crate is runtime-agnostic — it only ever .awaits, so the binary brings its own runtime
(see Architecture).
Writing a provider
A backend is any type implementing AutostartProvider. It must be Send + Sync so the
registry can hold it as a Box<dyn AutostartProvider> and share it across tasks. Implement the
seven methods, then hand an instance to Registry::new:
use Result;
use async_trait;
use ;
;
# async
Each AutostartEntry you return is tagged with your id as its source, so callers can
address it unambiguously as my-provider:<entry-id>.
Architecture
Async on purpose. The I/O methods are async because probing and querying some backends
(notably systemd over D-Bus) can block for a noticeable time. Keeping the core async and
runtime-agnostic means it only ever .awaits — it never spins up a runtime or block_ons — so a
GUI front-end can drive it without pinning its render thread on a slow bus call.
Aggregation never fails as a whole. Registry::all_entries collects a failing provider's
error into AggregateResult::errors while still returning every other provider's good results.
One broken backend never blanks the listing.
Order-preserving .desktop editing. The XDG provider toggles entries by setting/removing the
Hidden key via DesktopFile, which edits a single key while leaving comments, ordering, and
unrelated keys byte-for-byte intact.
License
Licensed under the MIT license.