|
@@ -4,10 +4,10 @@ mod comm;
|
|
|
mod config;
|
|
|
mod external;
|
|
|
mod bar;
|
|
|
+mod store;
|
|
|
|
|
|
use comm::{Channel, Message};
|
|
|
use config::Config;
|
|
|
-use std::collections::HashMap;
|
|
|
use std::sync::Arc;
|
|
|
use std::sync::mpsc;
|
|
|
use std::thread;
|
|
@@ -24,20 +24,18 @@ fn main() {
|
|
|
let mut topbar = bar::Bar::new(true);
|
|
|
let mut botbar = bar::Bar::new(false);
|
|
|
|
|
|
- let mut data = HashMap::new();
|
|
|
+ let mut data = store::Store::new();
|
|
|
|
|
|
loop {
|
|
|
let msg = rx.recv().unwrap();
|
|
|
- let empty = "".to_string();
|
|
|
- match msg {
|
|
|
- Message { kind, text } => data.insert(kind, text),
|
|
|
- };
|
|
|
+ data.save(msg);
|
|
|
+
|
|
|
topbar.send(&format!("{}%{{r}}{} | {}",
|
|
|
- data.get("title").unwrap_or(&empty),
|
|
|
- data.get("netspeed").unwrap_or(&empty),
|
|
|
- data.get("sensors").unwrap_or(&empty)
|
|
|
+ data.get("title"),
|
|
|
+ data.get("netspeed"),
|
|
|
+ data.get("sensors")
|
|
|
));
|
|
|
- botbar.send(&format!("{}", data.get("cmus").unwrap_or(&empty)));
|
|
|
+ botbar.send(&format!("{}", data.get("cmus")));
|
|
|
}
|
|
|
}
|
|
|
|