|
@@ -2,11 +2,11 @@ mod sensors;
|
|
|
mod netspeed;
|
|
|
mod comm;
|
|
|
mod config;
|
|
|
+mod external;
|
|
|
|
|
|
use comm::{Channel, Message};
|
|
|
use config::Config;
|
|
|
use std::collections::HashMap;
|
|
|
-use std::io;
|
|
|
use std::sync::Arc;
|
|
|
use std::sync::mpsc;
|
|
|
use std::thread;
|
|
@@ -16,7 +16,7 @@ fn main() {
|
|
|
let cfg = Arc::new(cfg);
|
|
|
|
|
|
let (tx, rx) = mpsc::channel::<Message>();
|
|
|
- make_thread(&tx, &cfg, stdin);
|
|
|
+ make_thread(&tx, &cfg, external::external);
|
|
|
make_thread(&tx, &cfg, sensors::sensors);
|
|
|
make_thread(&tx, &cfg, netspeed::netspeed);
|
|
|
|
|
@@ -28,7 +28,8 @@ fn main() {
|
|
|
match msg {
|
|
|
Message { kind, text } => data.insert(kind, text),
|
|
|
};
|
|
|
- println!("%{{r}}{} | {}",
|
|
|
+ println!("{}%{{r}}{} | {}",
|
|
|
+ data.get("title").unwrap_or(&empty),
|
|
|
data.get("netspeed").unwrap_or(&empty),
|
|
|
data.get("sensors").unwrap_or(&empty)
|
|
|
);
|
|
@@ -44,10 +45,3 @@ fn make_thread(tx: &Channel, cfg: &Arc<Config>, func: fn(&Channel, &Config) -> (
|
|
|
}
|
|
|
|
|
|
|
|
|
-fn stdin(tx: &Channel, _cfg: &Config) {
|
|
|
- let mut line = String::new();
|
|
|
- loop {
|
|
|
- io::stdin().read_line(&mut line).ok().expect("Failed to read line");
|
|
|
- }
|
|
|
-}
|
|
|
-
|