Split binaries into work and home version.

This commit is contained in:
Bill Thiede 2019-09-21 20:48:04 -07:00
parent cbb709afda
commit 1a2ad57826
3 changed files with 46 additions and 5 deletions

View File

@ -11,8 +11,12 @@ name = "i3xs"
path = "src/lib.rs"
[[bin]]
name = "i3xs"
path = "src/bin/main.rs"
name = "i3xs-work"
path = "src/bin/work.rs"
[[bin]]
name = "i3xs-home"
path = "src/bin/home.rs"
[dependencies]
i3monkit = "0.1.2"
@ -20,3 +24,4 @@ num_cpus = "1.0"
structopt = { version = "0.2", default-features = false }
chrono = "0.4"
chrono-tz = "0.5"
spark = "0.4.0"

35
src/bin/home.rs Normal file
View File

@ -0,0 +1,35 @@
use i3monkit::widgets::CpuWidget;
use i3monkit::{Header, I3Protocol, WidgetCollection};
use num_cpus;
use structopt::StructOpt;
use i3xs::widgets::datetime::DateTimeWidget;
use i3xs::widgets::network::NetworkSpeedWidget;
#[derive(Debug, StructOpt)]
#[structopt(name = "i3xs", about = "Custom i3 status bar program.")]
struct Opt {
#[structopt(short, long)]
nic: String,
}
fn main() {
let mut bar = WidgetCollection::new();
let opts = Opt::from_args();
//Display all the cpu usage for each core
for i in 0..num_cpus::get() as u32 {
bar.push(CpuWidget::new(i));
}
// Realtime upload/download rate for a interface
bar.push(NetworkSpeedWidget::new(&opts.nic));
bar.push(DateTimeWidget::new("%m/%d %H:%M".to_string()));
// Then start updating the status bar
bar.update_loop(I3Protocol::new(Header::new(1), std::io::stdout()));
}

View File

@ -1,11 +1,12 @@
use i3monkit::widgets::{CpuWidget, NetworkSpeedWidget};
use i3monkit::widgets::CpuWidget;
use i3monkit::{Header, I3Protocol, WidgetCollection};
use num_cpus;
use structopt::StructOpt;
use i3xs::widgets::DateTimeWidget;
use i3xs::widgets::datetime::DateTimeWidget;
use i3xs::widgets::network::NetworkSpeedWidget;
#[derive(Debug, StructOpt)]
#[structopt(name = "i3xs", about = "Custom i3 status bar program.")]
@ -33,6 +34,6 @@ fn main() {
));
bar.push(DateTimeWidget::new("%m/%d %H:%M".to_string()));
// Then start updating the satus bar
// Then start updating the status bar
bar.update_loop(I3Protocol::new(Header::new(1), std::io::stdout()));
}