forked from wathiede/i3xs
Split binaries into work and home version.
This commit is contained in:
parent
cbb709afda
commit
1a2ad57826
@ -11,8 +11,12 @@ name = "i3xs"
|
|||||||
path = "src/lib.rs"
|
path = "src/lib.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "i3xs"
|
name = "i3xs-work"
|
||||||
path = "src/bin/main.rs"
|
path = "src/bin/work.rs"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "i3xs-home"
|
||||||
|
path = "src/bin/home.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
i3monkit = "0.1.2"
|
i3monkit = "0.1.2"
|
||||||
@ -20,3 +24,4 @@ num_cpus = "1.0"
|
|||||||
structopt = { version = "0.2", default-features = false }
|
structopt = { version = "0.2", default-features = false }
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
chrono-tz = "0.5"
|
chrono-tz = "0.5"
|
||||||
|
spark = "0.4.0"
|
||||||
|
|||||||
35
src/bin/home.rs
Normal file
35
src/bin/home.rs
Normal 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()));
|
||||||
|
}
|
||||||
@ -1,11 +1,12 @@
|
|||||||
use i3monkit::widgets::{CpuWidget, NetworkSpeedWidget};
|
use i3monkit::widgets::CpuWidget;
|
||||||
use i3monkit::{Header, I3Protocol, WidgetCollection};
|
use i3monkit::{Header, I3Protocol, WidgetCollection};
|
||||||
|
|
||||||
use num_cpus;
|
use num_cpus;
|
||||||
|
|
||||||
use structopt::StructOpt;
|
use structopt::StructOpt;
|
||||||
|
|
||||||
use i3xs::widgets::DateTimeWidget;
|
use i3xs::widgets::datetime::DateTimeWidget;
|
||||||
|
use i3xs::widgets::network::NetworkSpeedWidget;
|
||||||
|
|
||||||
#[derive(Debug, StructOpt)]
|
#[derive(Debug, StructOpt)]
|
||||||
#[structopt(name = "i3xs", about = "Custom i3 status bar program.")]
|
#[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()));
|
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()));
|
bar.update_loop(I3Protocol::new(Header::new(1), std::io::stdout()));
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user