blob: c496e6a0e4a40131ae9c4f1eca6dbc4424e9f796 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
use std::process::Command;
use std::thread;
use std::time::Duration;
mod date;
mod disk;
mod load_config;
mod mem;
mod sound;
// TODO: this is sucks, maybe thread, i want to spawn some threads
fn main() {
let settings = load_config::load().unwrap();
sound::get_sound(&settings);
loop {
let mut bar = String::from("");
// the order of the IF's below matters to the final format
if settings.volume.enabled {
// volume return String
bar.push_str(&sound::get_sound(&settings));
}
if settings.disk.enabled {
// disk_free return String
bar.push_str(&disk::disk_free(&settings));
}
if settings.memory.enabled {
// mem return Result
bar.push_str(&mem::mem(&settings).unwrap());
}
bar.push_str(&date::fmt_date(&settings));
Command::new("xsetroot")
.arg("-name")
.arg(bar)
.output()
.unwrap();
thread::sleep(Duration::from_millis(75));
}
}
|