diff options
author | Mustafa Salih <37256744+MustafaSalih1993@users.noreply.github.com> | 2020-12-24 04:36:50 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-24 04:36:50 +0300 |
commit | 330e95ed1a9451d4ea23095ff9c5debeaa3943d7 (patch) | |
tree | aecb1ca581bd64e279c8fb43dd894db1628bf5a2 /src/main.rs | |
parent | f6affec55f1c20366e11accf76b99caf4528753f (diff) | |
parent | ffad8074c4b4a1e7a7af281126637499d1242ee7 (diff) |
Merge pull request #6 from MustafaSalih1993/dev
Added sound/volume and it can be customized through the rsblocks.yml…
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs index 23960af..bed2045 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,21 +6,36 @@ mod date; mod disk; mod load_config; mod mem; +mod sound; fn main() { let settings = load_config::load().unwrap(); - + sound::get_sound(&settings); loop { - let args = format!( - "{}{}{}", - disk::disk_free(&settings), - mem::mem(&settings).unwrap(), - date::fmt_date(&settings) - ); + 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(args) + .arg(bar) .output() .unwrap(); |