diff options
| author | mustafa salih <mustafasalih1991@gmail.com> | 2021-01-01 07:18:28 +0300 |
|---|---|---|
| committer | mustafa salih <mustafasalih1991@gmail.com> | 2021-01-01 07:18:28 +0300 |
| commit | 538866ca9b1120d31f6cab0edb8d7103618a057c (patch) | |
| tree | 45b5f3458fa06e68a2705efdee647bfd290177a2 /src/main.rs | |
| parent | 57eac590cc63ca9e4b70214f5353269f709a5650 (diff) | |
refactored code
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 46 |
1 files changed, 3 insertions, 43 deletions
diff --git a/src/main.rs b/src/main.rs index c496e6a..2211cb9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,46 +1,6 @@ -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 +use rsblocks; 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)); - } + let config = rsblocks::load_config().unwrap(); + rsblocks::run(config); } |
