runlatch_core/model.rs
1//! Provider-agnostic data model shared across all autostart providers.
2
3use serde::Serialize;
4
5/// Whether an autostart entry applies to the current user or the whole system.
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
7#[serde(rename_all = "lowercase")]
8pub enum Scope {
9 /// User-level autostart (e.g. `~/.config/autostart`, systemd `--user` units).
10 User,
11 /// System-level autostart (e.g. `/etc/xdg/autostart`, systemd system units).
12 System,
13}
14
15/// A single autostart item, normalized across providers.
16///
17/// `id` is stable and unique *within a provider*; pair it with [`AutostartEntry::source`]
18/// (the provider id) to address an entry unambiguously across the whole registry.
19#[derive(Debug, Clone, Serialize)]
20pub struct AutostartEntry {
21 /// Stable, unique within a provider (e.g. a `.desktop` file stem or a unit name).
22 pub id: String,
23 /// Human-readable name for display.
24 pub display_name: String,
25 /// Optional longer description.
26 pub description: Option<String>,
27 /// The command that runs at startup.
28 pub command: String,
29 /// Optional icon name or path.
30 pub icon: Option<String>,
31 /// Whether the entry is currently enabled.
32 pub enabled: bool,
33 /// The id of the provider that produced this entry, e.g. `"systemd-user"`.
34 pub source: String,
35 /// Whether the entry is user- or system-scoped.
36 pub scope: Scope,
37}