diff --git a/crates/spacesh-proto/src/config_view.rs b/crates/spacesh-proto/src/config_view.rs new file mode 100644 index 0000000..c41713a --- /dev/null +++ b/crates/spacesh-proto/src/config_view.rs @@ -0,0 +1,25 @@ +use serde::{Deserialize, Serialize}; + +/// Effective (resolved) daemon configuration sent to clients. +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct ConfigView { + pub default_shell: String, + pub font_family: String, + pub font_size: u16, + pub theme: String, + pub accent: String, +} + +#[cfg(test)] +mod tests { + use super::*; + #[test] + fn config_view_round_trips() { + let c = ConfigView { + default_shell: "/bin/zsh".into(), font_family: "JetBrains Mono".into(), + font_size: 13, theme: "dark".into(), accent: "blue".into(), + }; + let back: ConfigView = serde_json::from_str(&serde_json::to_string(&c).unwrap()).unwrap(); + assert_eq!(back, c); + } +} diff --git a/crates/spacesh-proto/src/lib.rs b/crates/spacesh-proto/src/lib.rs index addc79f..76d414f 100644 --- a/crates/spacesh-proto/src/lib.rs +++ b/crates/spacesh-proto/src/lib.rs @@ -1,4 +1,5 @@ pub mod codec; +pub mod config_view; pub mod event; pub mod ids; pub mod layout; @@ -6,6 +7,7 @@ pub mod message; pub mod status; pub mod workspace; +pub use config_view::ConfigView; pub use event::{EventKind, EventRecord, MarkReadTarget}; pub use ids::{GroupId, SurfaceId, WorkspaceId}; pub use layout::{LayoutNode, Orient};