Add battery tile implemented by reading from /sys
This commit is contained in:
parent
37d910d7f7
commit
4d5604f775
|
@ -7,6 +7,9 @@ type = "memory"
|
|||
[[tile]]
|
||||
type = "hostname"
|
||||
|
||||
[[tile]]
|
||||
type = "battery"
|
||||
|
||||
[[tile]]
|
||||
type = "time"
|
||||
format = "%Y-%m-%dT%H:%M:%S"
|
||||
|
|
|
@ -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<Block, Box<dyn std::error::Error + Send + Sync>>> {
|
||||
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))),
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue