diff --git a/config.toml.example b/config.toml.example index 873a12e..2486e18 100644 --- a/config.toml.example +++ b/config.toml.example @@ -7,6 +7,9 @@ type = "memory" [[tile]] type = "hostname" +[[tile]] +type = "battery" + [[tile]] type = "time" format = "%Y-%m-%dT%H:%M:%S" diff --git a/src/config.rs b/src/config.rs index 72dca17..3fc7eae 100644 --- a/src/config.rs +++ b/src/config.rs @@ -52,6 +52,7 @@ pub struct TileConfig { #[derive(Deserialize, Clone, Debug)] #[serde(tag = "type", rename_all = "snake_case")] pub enum TileConfigType { + Battery, Memory, Load, Hostname, @@ -115,6 +116,7 @@ pub fn process_tile( ) -> BoxStream<'static, Result>> { let five_secs = Duration::from_secs(5); match &tile.config_type { + TileConfigType::Battery => wrap(tiles::battery_stream(), tile.update.or(Some(five_secs))), TileConfigType::Hostname => wrap(tiles::hostname_stream(), tile.update), TileConfigType::Load => wrap(tiles::load_stream(), tile.update.or(Some(five_secs))), TileConfigType::Memory => wrap(tiles::memory_stream(), tile.update.or(Some(five_secs))), diff --git a/src/tiles/mod.rs b/src/tiles/mod.rs index 13a4c8c..712cd85 100644 --- a/src/tiles/mod.rs +++ b/src/tiles/mod.rs @@ -1,7 +1,9 @@ +pub mod battery; pub mod hostname; pub mod load; pub mod memory; pub mod time; +pub use battery::battery_stream; pub use hostname::hostname_stream; pub use load::load_stream; pub use memory::memory_stream;