forked from wathiede/i3xs
Working on multiple clock support.
This commit is contained in:
35
src/bin/main.rs
Normal file
35
src/bin/main.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
use i3monkit::{I3Protocol, Header, WidgetCollection};
|
||||
use i3monkit::widgets::{NetworkSpeedWidget, CpuWidget};
|
||||
|
||||
use num_cpus;
|
||||
|
||||
use structopt::StructOpt;
|
||||
|
||||
use i3xs::widgets::DateTimeWidget;
|
||||
|
||||
#[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();
|
||||
|
||||
// Realtime upload/download rate for a interface
|
||||
bar.push(NetworkSpeedWidget::new(&opts.nic));
|
||||
|
||||
//Display all the cpu usage for each core
|
||||
for i in 0..num_cpus::get() as u32 {
|
||||
bar.push(CpuWidget::new(i));
|
||||
}
|
||||
|
||||
bar.push(DateTimeWidget::new());
|
||||
bar.push(DateTimeWidget::new());
|
||||
|
||||
// Then start updating the satus bar
|
||||
bar.update_loop(I3Protocol::new(Header::new(1), std::io::stdout()));
|
||||
}
|
||||
Reference in New Issue
Block a user