|
@@ -6,10 +6,12 @@ mod external;
|
|
|
|
|
|
use comm::{Channel, Message};
|
|
|
use config::Config;
|
|
|
+use std::io::Write;
|
|
|
use std::collections::HashMap;
|
|
|
use std::sync::Arc;
|
|
|
use std::sync::mpsc;
|
|
|
use std::thread;
|
|
|
+use std::process;
|
|
|
|
|
|
fn main() {
|
|
|
let cfg = config::load("./panel.toml");
|
|
@@ -20,6 +22,16 @@ fn main() {
|
|
|
make_thread(&tx, &cfg, sensors::sensors);
|
|
|
make_thread(&tx, &cfg, netspeed::netspeed);
|
|
|
|
|
|
+ let bar = process::Command::new("lemonbar")
|
|
|
+ .arg("-f")
|
|
|
+ .arg("Inconsolatazi4:size=12")
|
|
|
+ .stdin(process::Stdio::piped())
|
|
|
+ .spawn()
|
|
|
+ .ok()
|
|
|
+ .expect("Failed to start lemonbar");
|
|
|
+
|
|
|
+ let mut output = bar.stdin.unwrap();
|
|
|
+
|
|
|
let mut data = HashMap::new();
|
|
|
|
|
|
loop {
|
|
@@ -28,11 +40,11 @@ fn main() {
|
|
|
match msg {
|
|
|
Message { kind, text } => data.insert(kind, text),
|
|
|
};
|
|
|
- println!("{}%{{r}}{} | {}",
|
|
|
+ writeln!(&mut output, "{}%{{r}}{} | {}",
|
|
|
data.get("title").unwrap_or(&empty),
|
|
|
data.get("netspeed").unwrap_or(&empty),
|
|
|
data.get("sensors").unwrap_or(&empty)
|
|
|
- );
|
|
|
+ ).ok();
|
|
|
}
|
|
|
}
|
|
|
|